diff --git a/manifest.json b/manifest.json index 3f63d22e7..a693e8fe7 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "variables": { - "${LATEST}": "3.343.21" + "${LATEST}": "3.343.23" }, "endpoints": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/endpoints.json", "services": { diff --git a/src/Service/Athena/CHANGELOG.md b/src/Service/Athena/CHANGELOG.md index 82f6fb048..d1e79eaec 100644 --- a/src/Service/Athena/CHANGELOG.md +++ b/src/Service/Athena/CHANGELOG.md @@ -2,6 +2,10 @@ ## NOT RELEASED +### Added + +- AWS api-change: 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. + ## 3.3.0 ### Added diff --git a/src/Service/Athena/composer.json b/src/Service/Athena/composer.json index dd1fcd043..84b824b33 100644 --- a/src/Service/Athena/composer.json +++ b/src/Service/Athena/composer.json @@ -29,7 +29,7 @@ }, "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } } } diff --git a/src/Service/Athena/src/AthenaClient.php b/src/Service/Athena/src/AthenaClient.php index e64f70097..73738793a 100644 --- a/src/Service/Athena/src/AthenaClient.php +++ b/src/Service/Athena/src/AthenaClient.php @@ -2,6 +2,7 @@ namespace AsyncAws\Athena; +use AsyncAws\Athena\Enum\QueryResultType; use AsyncAws\Athena\Exception\InternalServerException; use AsyncAws\Athena\Exception\InvalidRequestException; use AsyncAws\Athena\Exception\MetadataException; @@ -246,6 +247,7 @@ public function getQueryExecution($input): GetQueryExecutionOutput * QueryExecutionId: string, * NextToken?: null|string, * MaxResults?: null|int, + * QueryResultType?: null|QueryResultType::*, * '@region'?: string|null, * }|GetQueryResultsInput $input * @@ -788,6 +790,13 @@ protected function getEndpointMetadata(?string $region): array 'signService' => 'athena', 'signVersions' => ['v4'], ]; + case 'us-isob-east-1': + return [ + 'endpoint' => 'https://athena.us-isob-east-1.sc2s.sgov.gov', + 'signRegion' => 'us-isob-east-1', + 'signService' => 'athena', + 'signVersions' => ['v4'], + ]; } return [ diff --git a/src/Service/Athena/src/Enum/QueryResultType.php b/src/Service/Athena/src/Enum/QueryResultType.php new file mode 100644 index 000000000..45da29cb1 --- /dev/null +++ b/src/Service/Athena/src/Enum/QueryResultType.php @@ -0,0 +1,17 @@ + true, + self::DATA_ROWS => true, + ][$value]); + } +} diff --git a/src/Service/Athena/src/Input/GetQueryResultsInput.php b/src/Service/Athena/src/Input/GetQueryResultsInput.php index f9a982bca..4615cbd1c 100644 --- a/src/Service/Athena/src/Input/GetQueryResultsInput.php +++ b/src/Service/Athena/src/Input/GetQueryResultsInput.php @@ -2,6 +2,7 @@ namespace AsyncAws\Athena\Input; +use AsyncAws\Athena\Enum\QueryResultType; use AsyncAws\Core\Exception\InvalidArgument; use AsyncAws\Core\Input; use AsyncAws\Core\Request; @@ -34,11 +35,21 @@ final class GetQueryResultsInput extends Input */ private $maxResults; + /** + * When you set this to `DATA_ROWS` or empty, `GetQueryResults` returns the query results in rows. If set to + * `DATA_MANIFEST`, it returns the manifest file in rows. Only the query types `CREATE TABLE AS SELECT`, `UNLOAD`, and + * `INSERT` can generate a manifest file. If you use `DATA_MANIFEST` for other query types, the query will fail. + * + * @var QueryResultType::*|null + */ + private $queryResultType; + /** * @param array{ * QueryExecutionId?: string, * NextToken?: null|string, * MaxResults?: null|int, + * QueryResultType?: null|QueryResultType::*, * '@region'?: string|null, * } $input */ @@ -47,6 +58,7 @@ public function __construct(array $input = []) $this->queryExecutionId = $input['QueryExecutionId'] ?? null; $this->nextToken = $input['NextToken'] ?? null; $this->maxResults = $input['MaxResults'] ?? null; + $this->queryResultType = $input['QueryResultType'] ?? null; parent::__construct($input); } @@ -55,6 +67,7 @@ public function __construct(array $input = []) * QueryExecutionId?: string, * NextToken?: null|string, * MaxResults?: null|int, + * QueryResultType?: null|QueryResultType::*, * '@region'?: string|null, * }|GetQueryResultsInput $input */ @@ -78,6 +91,14 @@ public function getQueryExecutionId(): ?string return $this->queryExecutionId; } + /** + * @return QueryResultType::*|null + */ + public function getQueryResultType(): ?string + { + return $this->queryResultType; + } + /** * @internal */ @@ -125,6 +146,16 @@ public function setQueryExecutionId(?string $value): self return $this; } + /** + * @param QueryResultType::*|null $value + */ + public function setQueryResultType(?string $value): self + { + $this->queryResultType = $value; + + return $this; + } + private function requestBody(): array { $payload = []; @@ -138,6 +169,12 @@ private function requestBody(): array if (null !== $v = $this->maxResults) { $payload['MaxResults'] = $v; } + if (null !== $v = $this->queryResultType) { + if (!QueryResultType::exists($v)) { + throw new InvalidArgument(\sprintf('Invalid parameter "QueryResultType" for "%s". The value "%s" is not a valid "QueryResultType".', __CLASS__, $v)); + } + $payload['QueryResultType'] = $v; + } return $payload; } diff --git a/src/Service/Athena/src/Result/GetQueryExecutionOutput.php b/src/Service/Athena/src/Result/GetQueryExecutionOutput.php index 7e84c61e0..bfee29fd1 100644 --- a/src/Service/Athena/src/Result/GetQueryExecutionOutput.php +++ b/src/Service/Athena/src/Result/GetQueryExecutionOutput.php @@ -6,6 +6,8 @@ use AsyncAws\Athena\ValueObject\AthenaError; use AsyncAws\Athena\ValueObject\EncryptionConfiguration; use AsyncAws\Athena\ValueObject\EngineVersion; +use AsyncAws\Athena\ValueObject\ManagedQueryResultsConfiguration; +use AsyncAws\Athena\ValueObject\ManagedQueryResultsEncryptionConfiguration; use AsyncAws\Athena\ValueObject\QueryExecution; use AsyncAws\Athena\ValueObject\QueryExecutionContext; use AsyncAws\Athena\ValueObject\QueryExecutionStatistics; @@ -90,12 +92,28 @@ private function populateResultExecutionParameters(array $json): array return $items; } + private function populateResultManagedQueryResultsConfiguration(array $json): ManagedQueryResultsConfiguration + { + return new ManagedQueryResultsConfiguration([ + 'Enabled' => filter_var($json['Enabled'], \FILTER_VALIDATE_BOOLEAN), + 'EncryptionConfiguration' => empty($json['EncryptionConfiguration']) ? null : $this->populateResultManagedQueryResultsEncryptionConfiguration($json['EncryptionConfiguration']), + ]); + } + + private function populateResultManagedQueryResultsEncryptionConfiguration(array $json): ManagedQueryResultsEncryptionConfiguration + { + return new ManagedQueryResultsEncryptionConfiguration([ + 'KmsKey' => (string) $json['KmsKey'], + ]); + } + private function populateResultQueryExecution(array $json): QueryExecution { return new QueryExecution([ 'QueryExecutionId' => isset($json['QueryExecutionId']) ? (string) $json['QueryExecutionId'] : null, 'Query' => isset($json['Query']) ? (string) $json['Query'] : null, 'StatementType' => isset($json['StatementType']) ? (string) $json['StatementType'] : null, + 'ManagedQueryResultsConfiguration' => empty($json['ManagedQueryResultsConfiguration']) ? null : $this->populateResultManagedQueryResultsConfiguration($json['ManagedQueryResultsConfiguration']), 'ResultConfiguration' => empty($json['ResultConfiguration']) ? null : $this->populateResultResultConfiguration($json['ResultConfiguration']), 'ResultReuseConfiguration' => empty($json['ResultReuseConfiguration']) ? null : $this->populateResultResultReuseConfiguration($json['ResultReuseConfiguration']), 'QueryExecutionContext' => empty($json['QueryExecutionContext']) ? null : $this->populateResultQueryExecutionContext($json['QueryExecutionContext']), diff --git a/src/Service/Athena/src/Result/GetWorkGroupOutput.php b/src/Service/Athena/src/Result/GetWorkGroupOutput.php index e346c32c6..6b2dc9535 100644 --- a/src/Service/Athena/src/Result/GetWorkGroupOutput.php +++ b/src/Service/Athena/src/Result/GetWorkGroupOutput.php @@ -7,6 +7,8 @@ use AsyncAws\Athena\ValueObject\EncryptionConfiguration; use AsyncAws\Athena\ValueObject\EngineVersion; use AsyncAws\Athena\ValueObject\IdentityCenterConfiguration; +use AsyncAws\Athena\ValueObject\ManagedQueryResultsConfiguration; +use AsyncAws\Athena\ValueObject\ManagedQueryResultsEncryptionConfiguration; use AsyncAws\Athena\ValueObject\QueryResultsS3AccessGrantsConfiguration; use AsyncAws\Athena\ValueObject\ResultConfiguration; use AsyncAws\Athena\ValueObject\WorkGroup; @@ -75,6 +77,21 @@ private function populateResultIdentityCenterConfiguration(array $json): Identit ]); } + private function populateResultManagedQueryResultsConfiguration(array $json): ManagedQueryResultsConfiguration + { + return new ManagedQueryResultsConfiguration([ + 'Enabled' => filter_var($json['Enabled'], \FILTER_VALIDATE_BOOLEAN), + 'EncryptionConfiguration' => empty($json['EncryptionConfiguration']) ? null : $this->populateResultManagedQueryResultsEncryptionConfiguration($json['EncryptionConfiguration']), + ]); + } + + private function populateResultManagedQueryResultsEncryptionConfiguration(array $json): ManagedQueryResultsEncryptionConfiguration + { + return new ManagedQueryResultsEncryptionConfiguration([ + 'KmsKey' => (string) $json['KmsKey'], + ]); + } + private function populateResultQueryResultsS3AccessGrantsConfiguration(array $json): QueryResultsS3AccessGrantsConfiguration { return new QueryResultsS3AccessGrantsConfiguration([ @@ -110,6 +127,7 @@ private function populateResultWorkGroupConfiguration(array $json): WorkGroupCon { return new WorkGroupConfiguration([ 'ResultConfiguration' => empty($json['ResultConfiguration']) ? null : $this->populateResultResultConfiguration($json['ResultConfiguration']), + 'ManagedQueryResultsConfiguration' => empty($json['ManagedQueryResultsConfiguration']) ? null : $this->populateResultManagedQueryResultsConfiguration($json['ManagedQueryResultsConfiguration']), 'EnforceWorkGroupConfiguration' => isset($json['EnforceWorkGroupConfiguration']) ? filter_var($json['EnforceWorkGroupConfiguration'], \FILTER_VALIDATE_BOOLEAN) : null, 'PublishCloudWatchMetricsEnabled' => isset($json['PublishCloudWatchMetricsEnabled']) ? filter_var($json['PublishCloudWatchMetricsEnabled'], \FILTER_VALIDATE_BOOLEAN) : null, 'BytesScannedCutoffPerQuery' => isset($json['BytesScannedCutoffPerQuery']) ? (int) $json['BytesScannedCutoffPerQuery'] : null, diff --git a/src/Service/Athena/src/ValueObject/ManagedQueryResultsConfiguration.php b/src/Service/Athena/src/ValueObject/ManagedQueryResultsConfiguration.php new file mode 100644 index 000000000..0d5ee4a2a --- /dev/null +++ b/src/Service/Athena/src/ValueObject/ManagedQueryResultsConfiguration.php @@ -0,0 +1,70 @@ +enabled = $input['Enabled'] ?? $this->throwException(new InvalidArgument('Missing required field "Enabled".')); + $this->encryptionConfiguration = isset($input['EncryptionConfiguration']) ? ManagedQueryResultsEncryptionConfiguration::create($input['EncryptionConfiguration']) : null; + } + + /** + * @param array{ + * Enabled: bool, + * EncryptionConfiguration?: null|ManagedQueryResultsEncryptionConfiguration|array, + * }|ManagedQueryResultsConfiguration $input + */ + public static function create($input): self + { + return $input instanceof self ? $input : new self($input); + } + + public function getEnabled(): bool + { + return $this->enabled; + } + + public function getEncryptionConfiguration(): ?ManagedQueryResultsEncryptionConfiguration + { + return $this->encryptionConfiguration; + } + + /** + * @return never + */ + private function throwException(\Throwable $exception) + { + throw $exception; + } +} diff --git a/src/Service/Athena/src/ValueObject/ManagedQueryResultsEncryptionConfiguration.php b/src/Service/Athena/src/ValueObject/ManagedQueryResultsEncryptionConfiguration.php new file mode 100644 index 000000000..e32c15250 --- /dev/null +++ b/src/Service/Athena/src/ValueObject/ManagedQueryResultsEncryptionConfiguration.php @@ -0,0 +1,52 @@ +kmsKey = $input['KmsKey'] ?? $this->throwException(new InvalidArgument('Missing required field "KmsKey".')); + } + + /** + * @param array{ + * KmsKey: string, + * }|ManagedQueryResultsEncryptionConfiguration $input + */ + public static function create($input): self + { + return $input instanceof self ? $input : new self($input); + } + + public function getKmsKey(): string + { + return $this->kmsKey; + } + + /** + * @return never + */ + private function throwException(\Throwable $exception) + { + throw $exception; + } +} diff --git a/src/Service/Athena/src/ValueObject/QueryExecution.php b/src/Service/Athena/src/ValueObject/QueryExecution.php index 9952577d8..78d189c50 100644 --- a/src/Service/Athena/src/ValueObject/QueryExecution.php +++ b/src/Service/Athena/src/ValueObject/QueryExecution.php @@ -26,12 +26,20 @@ final class QueryExecution /** * The type of query statement that was run. `DDL` indicates DDL query statements. `DML` indicates DML (Data * Manipulation Language) query statements, such as `CREATE TABLE AS SELECT`. `UTILITY` indicates query statements other - * than DDL and DML, such as `SHOW CREATE TABLE`, `EXPLAIN`, `DESCRIBE`, or `SHOW TABLES`. + * than DDL and DML, such as `SHOW CREATE TABLE`, or `DESCRIBE TABLE`. * * @var StatementType::*|null */ private $statementType; + /** + * 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. + * + * @var ManagedQueryResultsConfiguration|null + */ + private $managedQueryResultsConfiguration; + /** * The location in Amazon S3 where query and calculation 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 @@ -112,6 +120,7 @@ final class QueryExecution * QueryExecutionId?: null|string, * Query?: null|string, * StatementType?: null|StatementType::*, + * ManagedQueryResultsConfiguration?: null|ManagedQueryResultsConfiguration|array, * ResultConfiguration?: null|ResultConfiguration|array, * ResultReuseConfiguration?: null|ResultReuseConfiguration|array, * QueryExecutionContext?: null|QueryExecutionContext|array, @@ -129,6 +138,7 @@ public function __construct(array $input) $this->queryExecutionId = $input['QueryExecutionId'] ?? null; $this->query = $input['Query'] ?? null; $this->statementType = $input['StatementType'] ?? null; + $this->managedQueryResultsConfiguration = isset($input['ManagedQueryResultsConfiguration']) ? ManagedQueryResultsConfiguration::create($input['ManagedQueryResultsConfiguration']) : null; $this->resultConfiguration = isset($input['ResultConfiguration']) ? ResultConfiguration::create($input['ResultConfiguration']) : null; $this->resultReuseConfiguration = isset($input['ResultReuseConfiguration']) ? ResultReuseConfiguration::create($input['ResultReuseConfiguration']) : null; $this->queryExecutionContext = isset($input['QueryExecutionContext']) ? QueryExecutionContext::create($input['QueryExecutionContext']) : null; @@ -146,6 +156,7 @@ public function __construct(array $input) * QueryExecutionId?: null|string, * Query?: null|string, * StatementType?: null|StatementType::*, + * ManagedQueryResultsConfiguration?: null|ManagedQueryResultsConfiguration|array, * ResultConfiguration?: null|ResultConfiguration|array, * ResultReuseConfiguration?: null|ResultReuseConfiguration|array, * QueryExecutionContext?: null|QueryExecutionContext|array, @@ -176,6 +187,11 @@ public function getExecutionParameters(): array return $this->executionParameters ?? []; } + public function getManagedQueryResultsConfiguration(): ?ManagedQueryResultsConfiguration + { + return $this->managedQueryResultsConfiguration; + } + public function getQuery(): ?string { return $this->query; diff --git a/src/Service/Athena/src/ValueObject/WorkGroupConfiguration.php b/src/Service/Athena/src/ValueObject/WorkGroupConfiguration.php index c50b50040..79d995894 100644 --- a/src/Service/Athena/src/ValueObject/WorkGroupConfiguration.php +++ b/src/Service/Athena/src/ValueObject/WorkGroupConfiguration.php @@ -23,6 +23,14 @@ final class WorkGroupConfiguration */ private $resultConfiguration; + /** + * 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. + * + * @var ManagedQueryResultsConfiguration|null + */ + private $managedQueryResultsConfiguration; + /** * 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 [^1]. @@ -121,6 +129,7 @@ final class WorkGroupConfiguration /** * @param array{ * ResultConfiguration?: null|ResultConfiguration|array, + * ManagedQueryResultsConfiguration?: null|ManagedQueryResultsConfiguration|array, * EnforceWorkGroupConfiguration?: null|bool, * PublishCloudWatchMetricsEnabled?: null|bool, * BytesScannedCutoffPerQuery?: null|int, @@ -137,6 +146,7 @@ final class WorkGroupConfiguration public function __construct(array $input) { $this->resultConfiguration = isset($input['ResultConfiguration']) ? ResultConfiguration::create($input['ResultConfiguration']) : null; + $this->managedQueryResultsConfiguration = isset($input['ManagedQueryResultsConfiguration']) ? ManagedQueryResultsConfiguration::create($input['ManagedQueryResultsConfiguration']) : null; $this->enforceWorkGroupConfiguration = $input['EnforceWorkGroupConfiguration'] ?? null; $this->publishCloudWatchMetricsEnabled = $input['PublishCloudWatchMetricsEnabled'] ?? null; $this->bytesScannedCutoffPerQuery = $input['BytesScannedCutoffPerQuery'] ?? null; @@ -153,6 +163,7 @@ public function __construct(array $input) /** * @param array{ * ResultConfiguration?: null|ResultConfiguration|array, + * ManagedQueryResultsConfiguration?: null|ManagedQueryResultsConfiguration|array, * EnforceWorkGroupConfiguration?: null|bool, * PublishCloudWatchMetricsEnabled?: null|bool, * BytesScannedCutoffPerQuery?: null|int, @@ -211,6 +222,11 @@ public function getIdentityCenterConfiguration(): ?IdentityCenterConfiguration return $this->identityCenterConfiguration; } + public function getManagedQueryResultsConfiguration(): ?ManagedQueryResultsConfiguration + { + return $this->managedQueryResultsConfiguration; + } + public function getPublishCloudWatchMetricsEnabled(): ?bool { return $this->publishCloudWatchMetricsEnabled;