Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
4 changes: 4 additions & 0 deletions src/Service/Athena/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Service/Athena/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
"dev-master": "3.4-dev"
}
}
}
9 changes: 9 additions & 0 deletions src/Service/Athena/src/AthenaClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
*
Expand Down Expand Up @@ -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 [
Expand Down
17 changes: 17 additions & 0 deletions src/Service/Athena/src/Enum/QueryResultType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace AsyncAws\Athena\Enum;

final class QueryResultType
{
public const DATA_MANIFEST = 'DATA_MANIFEST';
public const DATA_ROWS = 'DATA_ROWS';

public static function exists(string $value): bool
{
return isset([
self::DATA_MANIFEST => true,
self::DATA_ROWS => true,
][$value]);
}
}
37 changes: 37 additions & 0 deletions src/Service/Athena/src/Input/GetQueryResultsInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
*/
Expand All @@ -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);
}

Expand All @@ -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
*/
Expand All @@ -78,6 +91,14 @@ public function getQueryExecutionId(): ?string
return $this->queryExecutionId;
}

/**
* @return QueryResultType::*|null
*/
public function getQueryResultType(): ?string
{
return $this->queryResultType;
}

/**
* @internal
*/
Expand Down Expand Up @@ -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 = [];
Expand All @@ -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;
}
Expand Down
18 changes: 18 additions & 0 deletions src/Service/Athena/src/Result/GetQueryExecutionOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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']),
Expand Down
18 changes: 18 additions & 0 deletions src/Service/Athena/src/Result/GetWorkGroupOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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([
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

namespace AsyncAws\Athena\ValueObject;

use AsyncAws\Core\Exception\InvalidArgument;

/**
* 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.
*/
final class ManagedQueryResultsConfiguration
{
/**
* If set to true, allows you to store query results in Athena owned storage. If set to false, workgroup member stores
* query results in location specified under `ResultConfiguration$OutputLocation`. The default is false. A workgroup
* cannot have the `ResultConfiguration$OutputLocation` parameter when you set this field to true.
*
* @var bool
*/
private $enabled;

/**
* If you encrypt query and calculation results in Athena owned storage, this field indicates the encryption option (for
* example, SSE_KMS or CSE_KMS) and key information.
*
* @var ManagedQueryResultsEncryptionConfiguration|null
*/
private $encryptionConfiguration;

/**
* @param array{
* Enabled: bool,
* EncryptionConfiguration?: null|ManagedQueryResultsEncryptionConfiguration|array,
* } $input
*/
public function __construct(array $input)
{
$this->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;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

namespace AsyncAws\Athena\ValueObject;

use AsyncAws\Core\Exception\InvalidArgument;

/**
* If you encrypt query and calculation results in Athena owned storage, this field indicates the encryption option (for
* example, SSE_KMS or CSE_KMS) and key information.
*/
final class ManagedQueryResultsEncryptionConfiguration
{
/**
* The ARN of an KMS key for encrypting managed query results.
*
* @var string
*/
private $kmsKey;

/**
* @param array{
* KmsKey: string,
* } $input
*/
public function __construct(array $input)
{
$this->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;
}
}
Loading