Skip to content

Commit 33fac0a

Browse files
author
awstools
committed
feat(client-athena): Add support for the managed query result in the workgroup APIs. The managed query result configuration enables users to store query results to Athena owned storage.
1 parent 9bec4ef commit 33fac0a

File tree

9 files changed

+268
-3
lines changed

9 files changed

+268
-3
lines changed

clients/client-athena/src/commands/BatchGetQueryExecutionCommand.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ export interface BatchGetQueryExecutionCommandOutput extends BatchGetQueryExecut
5353
* // QueryExecutionId: "STRING_VALUE",
5454
* // Query: "STRING_VALUE",
5555
* // StatementType: "DDL" || "DML" || "UTILITY",
56+
* // ManagedQueryResultsConfiguration: { // ManagedQueryResultsConfiguration
57+
* // Enabled: true || false, // required
58+
* // EncryptionConfiguration: { // ManagedQueryResultsEncryptionConfiguration
59+
* // KmsKey: "STRING_VALUE", // required
60+
* // },
61+
* // },
5662
* // ResultConfiguration: { // ResultConfiguration
5763
* // OutputLocation: "STRING_VALUE",
5864
* // EncryptionConfiguration: { // EncryptionConfiguration

clients/client-athena/src/commands/CreateWorkGroupCommand.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ export interface CreateWorkGroupCommandOutput extends CreateWorkGroupOutput, __M
5050
* S3AclOption: "BUCKET_OWNER_FULL_CONTROL", // required
5151
* },
5252
* },
53+
* ManagedQueryResultsConfiguration: { // ManagedQueryResultsConfiguration
54+
* Enabled: true || false, // required
55+
* EncryptionConfiguration: { // ManagedQueryResultsEncryptionConfiguration
56+
* KmsKey: "STRING_VALUE", // required
57+
* },
58+
* },
5359
* EnforceWorkGroupConfiguration: true || false,
5460
* PublishCloudWatchMetricsEnabled: true || false,
5561
* BytesScannedCutoffPerQuery: Number("long"),

clients/client-athena/src/commands/GetQueryExecutionCommand.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ export interface GetQueryExecutionCommandOutput extends GetQueryExecutionOutput,
4747
* // QueryExecutionId: "STRING_VALUE",
4848
* // Query: "STRING_VALUE",
4949
* // StatementType: "DDL" || "DML" || "UTILITY",
50+
* // ManagedQueryResultsConfiguration: { // ManagedQueryResultsConfiguration
51+
* // Enabled: true || false, // required
52+
* // EncryptionConfiguration: { // ManagedQueryResultsEncryptionConfiguration
53+
* // KmsKey: "STRING_VALUE", // required
54+
* // },
55+
* // },
5056
* // ResultConfiguration: { // ResultConfiguration
5157
* // OutputLocation: "STRING_VALUE",
5258
* // EncryptionConfiguration: { // EncryptionConfiguration

clients/client-athena/src/commands/GetQueryResultsCommand.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export interface GetQueryResultsCommandOutput extends GetQueryResultsOutput, __M
5454
* QueryExecutionId: "STRING_VALUE", // required
5555
* NextToken: "STRING_VALUE",
5656
* MaxResults: Number("int"),
57+
* QueryResultType: "DATA_MANIFEST" || "DATA_ROWS",
5758
* };
5859
* const command = new GetQueryResultsCommand(input);
5960
* const response = await client.send(command);

clients/client-athena/src/commands/GetWorkGroupCommand.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ export interface GetWorkGroupCommandOutput extends GetWorkGroupOutput, __Metadat
5656
* // S3AclOption: "BUCKET_OWNER_FULL_CONTROL", // required
5757
* // },
5858
* // },
59+
* // ManagedQueryResultsConfiguration: { // ManagedQueryResultsConfiguration
60+
* // Enabled: true || false, // required
61+
* // EncryptionConfiguration: { // ManagedQueryResultsEncryptionConfiguration
62+
* // KmsKey: "STRING_VALUE", // required
63+
* // },
64+
* // },
5965
* // EnforceWorkGroupConfiguration: true || false,
6066
* // PublishCloudWatchMetricsEnabled: true || false,
6167
* // BytesScannedCutoffPerQuery: Number("long"),

clients/client-athena/src/commands/UpdateWorkGroupCommand.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ export interface UpdateWorkGroupCommandOutput extends UpdateWorkGroupOutput, __M
5656
* },
5757
* RemoveAclConfiguration: true || false,
5858
* },
59+
* ManagedQueryResultsConfigurationUpdates: { // ManagedQueryResultsConfigurationUpdates
60+
* Enabled: true || false,
61+
* EncryptionConfiguration: { // ManagedQueryResultsEncryptionConfiguration
62+
* KmsKey: "STRING_VALUE", // required
63+
* },
64+
* RemoveEncryptionConfiguration: true || false,
65+
* },
5966
* PublishCloudWatchMetricsEnabled: true || false,
6067
* BytesScannedCutoffPerQuery: Number("long"),
6168
* RemoveBytesScannedCutoffPerQuery: true || false,

clients/client-athena/src/models/models_0.ts

Lines changed: 117 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,46 @@ export interface EngineVersion {
341341
EffectiveEngineVersion?: string | undefined;
342342
}
343343

344+
/**
345+
* <p>If you encrypt query and calculation results in Athena owned storage, this field
346+
* indicates the encryption option (for example, SSE_KMS or CSE_KMS) and key
347+
* information.</p>
348+
* @public
349+
*/
350+
export interface ManagedQueryResultsEncryptionConfiguration {
351+
/**
352+
* <p>The ARN of an KMS key for encrypting managed query results.</p>
353+
* @public
354+
*/
355+
KmsKey: string | undefined;
356+
}
357+
358+
/**
359+
* <p>
360+
* The configuration for storing results in Athena owned storage, which includes whether this feature is enabled; whether encryption configuration, if any, is used for encrypting query results.
361+
* </p>
362+
* @public
363+
*/
364+
export interface ManagedQueryResultsConfiguration {
365+
/**
366+
* <p>If set to true, allows you to store query results in Athena owned storage. If set to
367+
* false, workgroup member stores query results in location specified under
368+
* <code>ResultConfiguration$OutputLocation</code>. The default is false. A workgroup
369+
* cannot have the <code>ResultConfiguration$OutputLocation</code> parameter when you set
370+
* this field to true. </p>
371+
* @public
372+
*/
373+
Enabled: boolean | undefined;
374+
375+
/**
376+
* <p>If you encrypt query and calculation results in Athena owned storage, this field
377+
* indicates the encryption option (for example, SSE_KMS or CSE_KMS) and key
378+
* information.</p>
379+
* @public
380+
*/
381+
EncryptionConfiguration?: ManagedQueryResultsEncryptionConfiguration | undefined;
382+
}
383+
344384
/**
345385
* <p>The database and data catalog context in which the query execution occurs.</p>
346386
* @public
@@ -768,12 +808,20 @@ export interface QueryExecution {
768808
* <p>The type of query statement that was run. <code>DDL</code> indicates DDL query
769809
* statements. <code>DML</code> indicates DML (Data Manipulation Language) query
770810
* statements, such as <code>CREATE TABLE AS SELECT</code>. <code>UTILITY</code> indicates
771-
* query statements other than DDL and DML, such as <code>SHOW CREATE TABLE</code>,
772-
* <code>EXPLAIN</code>, <code>DESCRIBE</code>, or <code>SHOW TABLES</code>.</p>
811+
* query statements other than DDL and DML, such as <code>SHOW CREATE TABLE</code>, or
812+
* <code>DESCRIBE TABLE</code>.</p>
773813
* @public
774814
*/
775815
StatementType?: StatementType | undefined;
776816

817+
/**
818+
* <p> The configuration for storing results in Athena owned storage, which includes whether
819+
* this feature is enabled; whether encryption configuration, if any, is used for
820+
* encrypting query results. </p>
821+
* @public
822+
*/
823+
ManagedQueryResultsConfiguration?: ManagedQueryResultsConfiguration | undefined;
824+
777825
/**
778826
* <p>The location in Amazon S3 where query and calculation results are stored and
779827
* the encryption option, if any, used for query results. These are known as "client-side
@@ -1700,6 +1748,14 @@ export interface WorkGroupConfiguration {
17001748
*/
17011749
ResultConfiguration?: ResultConfiguration | undefined;
17021750

1751+
/**
1752+
* <p> The configuration for storing results in Athena owned storage, which includes whether
1753+
* this feature is enabled; whether encryption configuration, if any, is used for
1754+
* encrypting query results. </p>
1755+
* @public
1756+
*/
1757+
ManagedQueryResultsConfiguration?: ManagedQueryResultsConfiguration | undefined;
1758+
17031759
/**
17041760
* <p>If set to "true", the settings for the workgroup override client-side settings. If set
17051761
* to "false", client-side settings are used. For more information, see <a href="https://docs.aws.amazon.com/athena/latest/ug/workgroups-settings-override.html">Workgroup Settings Override Client-Side Settings</a>.</p>
@@ -2675,6 +2731,20 @@ export interface GetQueryExecutionOutput {
26752731
QueryExecution?: QueryExecution | undefined;
26762732
}
26772733

2734+
/**
2735+
* @public
2736+
* @enum
2737+
*/
2738+
export const QueryResultType = {
2739+
DATA_MANIFEST: "DATA_MANIFEST",
2740+
DATA_ROWS: "DATA_ROWS",
2741+
} as const;
2742+
2743+
/**
2744+
* @public
2745+
*/
2746+
export type QueryResultType = (typeof QueryResultType)[keyof typeof QueryResultType];
2747+
26782748
/**
26792749
* @public
26802750
*/
@@ -2698,6 +2768,16 @@ export interface GetQueryResultsInput {
26982768
* @public
26992769
*/
27002770
MaxResults?: number | undefined;
2771+
2772+
/**
2773+
* <p> When you set this to <code>DATA_ROWS</code> or empty, <code>GetQueryResults</code>
2774+
* returns the query results in rows. If set to <code>DATA_MANIFEST</code>, it returns the
2775+
* manifest file in rows. Only the query types <code>CREATE TABLE AS SELECT</code>,
2776+
* <code>UNLOAD</code>, and <code>INSERT</code> can generate a manifest file. If you
2777+
* use <code>DATA_MANIFEST</code> for other query types, the query will fail. </p>
2778+
* @public
2779+
*/
2780+
QueryResultType?: QueryResultType | undefined;
27012781
}
27022782

27032783
/**
@@ -5348,6 +5428,35 @@ export interface UpdatePreparedStatementInput {
53485428
*/
53495429
export interface UpdatePreparedStatementOutput {}
53505430

5431+
/**
5432+
* <p>Updates the configuration for managed query results.</p>
5433+
* @public
5434+
*/
5435+
export interface ManagedQueryResultsConfigurationUpdates {
5436+
/**
5437+
* <p>If set to true, specifies that Athena manages query results in Athena owned
5438+
* storage.</p>
5439+
* @public
5440+
*/
5441+
Enabled?: boolean | undefined;
5442+
5443+
/**
5444+
* <p>If you encrypt query and calculation results in Athena owned storage, this field
5445+
* indicates the encryption option (for example, SSE_KMS or CSE_KMS) and key
5446+
* information.</p>
5447+
* @public
5448+
*/
5449+
EncryptionConfiguration?: ManagedQueryResultsEncryptionConfiguration | undefined;
5450+
5451+
/**
5452+
* <p>If set to true, it removes workgroup from Athena owned storage. The existing query
5453+
* results are cleaned up after 24hrs. You must provide query results in location specified
5454+
* under <code>ResultConfiguration$OutputLocation</code>.</p>
5455+
* @public
5456+
*/
5457+
RemoveEncryptionConfiguration?: boolean | undefined;
5458+
}
5459+
53515460
/**
53525461
* <p>The information about the updates in the query results, such as output location and
53535462
* encryption configuration for the query results.</p>
@@ -5467,6 +5576,12 @@ export interface WorkGroupConfigurationUpdates {
54675576
*/
54685577
ResultConfigurationUpdates?: ResultConfigurationUpdates | undefined;
54695578

5579+
/**
5580+
* <p>Updates configuration information for managed query results in the workgroup.</p>
5581+
* @public
5582+
*/
5583+
ManagedQueryResultsConfigurationUpdates?: ManagedQueryResultsConfigurationUpdates | undefined;
5584+
54705585
/**
54715586
* <p>Indicates whether this workgroup enables publishing metrics to Amazon CloudWatch.</p>
54725587
* @public

clients/client-athena/src/protocols/Aws_json1_1.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ import {
274274
ListTagsForResourceInput,
275275
ListWorkGroupsInput,
276276
ListWorkGroupsOutput,
277+
ManagedQueryResultsConfiguration,
278+
ManagedQueryResultsConfigurationUpdates,
279+
ManagedQueryResultsEncryptionConfiguration,
277280
MetadataException,
278281
NotebookMetadata,
279282
NotebookSessionSummary,
@@ -2839,6 +2842,12 @@ const se_DeleteNamedQueryInput = (input: DeleteNamedQueryInput, context: __Serde
28392842

28402843
// se_ListWorkGroupsInput omitted.
28412844

2845+
// se_ManagedQueryResultsConfiguration omitted.
2846+
2847+
// se_ManagedQueryResultsConfigurationUpdates omitted.
2848+
2849+
// se_ManagedQueryResultsEncryptionConfiguration omitted.
2850+
28422851
// se_NamedQueryIdList omitted.
28432852

28442853
// se_ParametersMap omitted.
@@ -3350,6 +3359,10 @@ const de_ListWorkGroupsOutput = (output: any, context: __SerdeContext): ListWork
33503359
}) as any;
33513360
};
33523361

3362+
// de_ManagedQueryResultsConfiguration omitted.
3363+
3364+
// de_ManagedQueryResultsEncryptionConfiguration omitted.
3365+
33533366
// de_MetadataException omitted.
33543367

33553368
// de_NamedQuery omitted.
@@ -3464,6 +3477,7 @@ const de_QueryExecution = (output: any, context: __SerdeContext): QueryExecution
34643477
return take(output, {
34653478
EngineVersion: _json,
34663479
ExecutionParameters: _json,
3480+
ManagedQueryResultsConfiguration: _json,
34673481
Query: __expectString,
34683482
QueryExecutionContext: _json,
34693483
QueryExecutionId: __expectString,

0 commit comments

Comments
 (0)