From d530b57e1ee8260bdf696f91cb650a60f32ecd95 Mon Sep 17 00:00:00 2001 From: AsyncAws Bot Date: Wed, 22 Nov 2023 06:23:09 +0000 Subject: [PATCH] update generated code --- manifest.json | 2 +- src/Core/CHANGELOG.md | 1 + src/Core/src/Sts/Input/AssumeRoleRequest.php | 8 +- .../src/Sts/ValueObject/ProvidedContext.php | 8 +- src/Service/Athena/CHANGELOG.md | 1 + src/Service/Athena/src/AthenaClient.php | 25 +- .../StartCalculationExecutionRequest.php | 3 +- .../src/Result/GetQueryExecutionOutput.php | 1 + ...CustomerContentEncryptionConfiguration.php | 6 +- .../Athena/src/ValueObject/DataCatalog.php | 2 - .../ValueObject/QueryExecutionStatistics.php | 15 ++ .../src/ValueObject/SessionConfiguration.php | 3 +- .../ValueObject/WorkGroupConfiguration.php | 3 +- .../src/CloudFormationClient.php | 4 +- src/Service/EventBridge/CHANGELOG.md | 4 + .../EventBridge/src/EventBridgeClient.php | 9 + .../src/ValueObject/PutEventsRequestEntry.php | 24 +- .../src/ValueObject/PutEventsResultEntry.php | 47 +++- src/Service/Iot/CHANGELOG.md | 1 + src/Service/Iot/src/IotClient.php | 3 + src/Service/Lambda/CHANGELOG.md | 5 + .../Lambda/src/Enum/ApplicationLogLevel.php | 25 ++ src/Service/Lambda/src/Enum/LogFormat.php | 17 ++ src/Service/Lambda/src/Enum/Runtime.php | 8 + .../Lambda/src/Enum/SystemLogLevel.php | 19 ++ .../UpdateFunctionConfigurationRequest.php | 26 ++ src/Service/Lambda/src/LambdaClient.php | 8 +- .../src/Result/FunctionConfiguration.php | 26 ++ .../src/Result/ListFunctionsResponse.php | 12 + .../Result/ListVersionsByFunctionResponse.php | 12 + .../src/ValueObject/FunctionConfiguration.php | 15 ++ .../Lambda/src/ValueObject/LoggingConfig.php | 136 ++++++++++ src/Service/MediaConvert/CHANGELOG.md | 1 + .../MediaConvert/src/Enum/AudioChannelTag.php | 6 +- .../src/Enum/F4vMoovPlacement.php | 4 +- .../src/Enum/Mp4MoovPlacement.php | 4 +- .../MediaConvert/src/Enum/ScalingBehavior.php | 12 +- .../src/Result/CreateJobResponse.php | 19 ++ .../src/Result/GetJobResponse.php | 19 ++ .../src/Result/ListJobsResponse.php | 19 ++ .../src/ValueObject/AiffSettings.php | 2 +- .../AudioChannelTaggingSettings.php | 46 +++- .../src/ValueObject/AudioDescription.php | 8 +- .../src/ValueObject/F4vSettings.php | 4 +- .../src/ValueObject/FlacSettings.php | 2 +- .../src/ValueObject/JobSettings.php | 22 ++ .../src/ValueObject/Mp2Settings.php | 2 +- .../src/ValueObject/Mp3Settings.php | 2 +- .../src/ValueObject/Mp4Settings.php | 4 +- .../src/ValueObject/OpusSettings.php | 2 +- .../src/ValueObject/VideoDescription.php | 6 +- .../src/ValueObject/VideoOverlay.php | 3 +- .../src/ValueObject/VideoOverlayInput.php | 8 +- .../Input/CompleteMultipartUploadRequest.php | 8 +- .../S3/src/Input/CopyObjectRequest.php | 3 +- src/Service/S3/src/Input/PutObjectRequest.php | 2 +- src/Service/S3/src/Result/GetObjectOutput.php | 2 +- .../S3/src/Result/HeadObjectOutput.php | 2 +- src/Service/S3/src/S3Client.php | 13 +- src/Service/Sqs/CHANGELOG.md | 5 + src/Service/Sqs/composer.json | 2 +- .../src/Exception/InvalidAddressException.php | 12 + .../InvalidAttributeValueException.php | 12 + .../Exception/InvalidSecurityException.php | 12 + .../Exception/KmsAccessDeniedException.php | 12 + .../src/Exception/KmsDisabledException.php | 12 + .../Exception/KmsInvalidKeyUsageException.php | 16 ++ .../Exception/KmsInvalidStateException.php | 12 + .../src/Exception/KmsNotFoundException.php | 12 + .../Exception/KmsOptInRequiredException.php | 12 + .../src/Exception/KmsThrottledException.php | 12 + .../Exception/RequestThrottledException.php | 20 ++ .../ChangeMessageVisibilityBatchRequest.php | 17 +- .../Input/ChangeMessageVisibilityRequest.php | 8 +- .../Sqs/src/Input/CreateQueueRequest.php | 36 +-- .../src/Input/DeleteMessageBatchRequest.php | 17 +- .../Sqs/src/Input/DeleteMessageRequest.php | 8 +- .../Sqs/src/Input/DeleteQueueRequest.php | 8 +- .../src/Input/GetQueueAttributesRequest.php | 19 +- .../Sqs/src/Input/GetQueueUrlRequest.php | 8 +- .../Sqs/src/Input/ListQueuesRequest.php | 8 +- .../Sqs/src/Input/PurgeQueueRequest.php | 8 +- .../Sqs/src/Input/ReceiveMessageRequest.php | 26 +- .../Sqs/src/Input/SendMessageBatchRequest.php | 17 +- .../Sqs/src/Input/SendMessageRequest.php | 38 +-- .../ChangeMessageVisibilityBatchResult.php | 43 ++-- .../Sqs/src/Result/CreateQueueResult.php | 5 +- .../src/Result/DeleteMessageBatchResult.php | 43 ++-- .../src/Result/GetQueueAttributesResult.php | 12 +- .../Sqs/src/Result/GetQueueUrlResult.php | 5 +- .../Sqs/src/Result/ListQueuesResult.php | 13 +- .../Sqs/src/Result/QueueExistsWaiter.php | 2 +- .../Sqs/src/Result/ReceiveMessageResult.php | 75 +++--- .../Sqs/src/Result/SendMessageBatchResult.php | 53 ++-- .../Sqs/src/Result/SendMessageResult.php | 15 +- src/Service/Sqs/src/SqsClient.php | 235 ++++++++++++++++-- .../src/ValueObject/MessageAttributeValue.php | 14 +- .../MessageSystemAttributeValue.php | 14 +- .../SendMessageBatchRequestEntry.php | 30 +-- src/Service/StepFunctions/CHANGELOG.md | 4 + .../Exception/TaskDoesNotExistException.php | 3 + .../src/Exception/TaskTimedOutException.php | 3 + .../src/Input/StartExecutionInput.php | 3 + .../StepFunctions/src/StepFunctionsClient.php | 25 +- 104 files changed, 1314 insertions(+), 356 deletions(-) create mode 100644 src/Service/Lambda/src/Enum/ApplicationLogLevel.php create mode 100644 src/Service/Lambda/src/Enum/LogFormat.php create mode 100644 src/Service/Lambda/src/Enum/SystemLogLevel.php create mode 100644 src/Service/Lambda/src/ValueObject/LoggingConfig.php create mode 100644 src/Service/Sqs/src/Exception/InvalidAddressException.php create mode 100644 src/Service/Sqs/src/Exception/InvalidAttributeValueException.php create mode 100644 src/Service/Sqs/src/Exception/InvalidSecurityException.php create mode 100644 src/Service/Sqs/src/Exception/KmsAccessDeniedException.php create mode 100644 src/Service/Sqs/src/Exception/KmsDisabledException.php create mode 100644 src/Service/Sqs/src/Exception/KmsInvalidKeyUsageException.php create mode 100644 src/Service/Sqs/src/Exception/KmsInvalidStateException.php create mode 100644 src/Service/Sqs/src/Exception/KmsNotFoundException.php create mode 100644 src/Service/Sqs/src/Exception/KmsOptInRequiredException.php create mode 100644 src/Service/Sqs/src/Exception/KmsThrottledException.php create mode 100644 src/Service/Sqs/src/Exception/RequestThrottledException.php diff --git a/manifest.json b/manifest.json index a98c28cfe..eff2f0b2f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "variables": { - "${LATEST}": "3.284.1" + "${LATEST}": "3.288.0" }, "endpoints": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/endpoints.json", "services": { diff --git a/src/Core/CHANGELOG.md b/src/Core/CHANGELOG.md index 3ab8ee390..243580cf5 100644 --- a/src/Core/CHANGELOG.md +++ b/src/Core/CHANGELOG.md @@ -5,6 +5,7 @@ ### Changed - Allow passing explicit null values for optional fields of input objects +- AWS enhancement: Documentation updates. ### Fixed diff --git a/src/Core/src/Sts/Input/AssumeRoleRequest.php b/src/Core/src/Sts/Input/AssumeRoleRequest.php index 061747a12..546558f45 100644 --- a/src/Core/src/Sts/Input/AssumeRoleRequest.php +++ b/src/Core/src/Sts/Input/AssumeRoleRequest.php @@ -230,7 +230,13 @@ final class AssumeRoleRequest extends Input private $sourceIdentity; /** - * Reserved for future use. + * A list of previously acquired trusted context assertions in the format of a JSON array. The trusted context assertion + * is signed and encrypted by Amazon Web Services STS. + * + * The following is an example of a `ProvidedContext` value that includes a single trusted context assertion and the ARN + * of the context provider from which the trusted context assertion was generated. + * + * `[{"ProviderArn":"arn:aws:iam::aws:contextProvider/identitycenter","ContextAssertion":"trusted-context-assertion"}]` * * @var ProvidedContext[]|null */ diff --git a/src/Core/src/Sts/ValueObject/ProvidedContext.php b/src/Core/src/Sts/ValueObject/ProvidedContext.php index 950e3eb49..2c66fa8d7 100644 --- a/src/Core/src/Sts/ValueObject/ProvidedContext.php +++ b/src/Core/src/Sts/ValueObject/ProvidedContext.php @@ -3,19 +3,21 @@ namespace AsyncAws\Core\Sts\ValueObject; /** - * Reserved for future use. + * Contains information about the provided context. This includes the signed and encrypted trusted context assertion and + * the context provider ARN from which the trusted context assertion was generated. */ final class ProvidedContext { /** - * Reserved for future use. + * The context provider ARN from which the trusted context assertion was generated. * * @var string|null */ private $providerArn; /** - * Reserved for future use. + * The signed and encrypted trusted context assertion generated by the context provider. The trusted context assertion + * is signed and encrypted by Amazon Web Services STS. * * @var string|null */ diff --git a/src/Service/Athena/CHANGELOG.md b/src/Service/Athena/CHANGELOG.md index dbe8de9b1..495095715 100644 --- a/src/Service/Athena/CHANGELOG.md +++ b/src/Service/Athena/CHANGELOG.md @@ -5,6 +5,7 @@ ### Added - Added `il-central-1` region +- AWS api-change: Adding SerivicePreProcessing time metric ### Changed diff --git a/src/Service/Athena/src/AthenaClient.php b/src/Service/Athena/src/AthenaClient.php index d8366819a..51bd05da7 100644 --- a/src/Service/Athena/src/AthenaClient.php +++ b/src/Service/Athena/src/AthenaClient.php @@ -406,11 +406,6 @@ public function listDatabases($input): ListDatabasesOutput * access to the specified workgroup. If a workgroup is not specified, lists the saved queries for the primary * workgroup. * - * For code samples using the Amazon Web Services SDK for Java, see Examples and Code Samples [^1] in the *Amazon Athena - * User Guide*. - * - * [^1]: http://docs.aws.amazon.com/athena/latest/ug/code-samples.html - * * @see https://docs.aws.amazon.com/athena/latest/APIReference/API_ListNamedQueries.html * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-athena-2017-05-18.html#listnamedqueries * @@ -436,14 +431,9 @@ public function listNamedQueries($input = []): ListNamedQueriesOutput } /** - * Provides a list of available query execution IDs for the queries in the specified workgroup. If a workgroup is not - * specified, returns a list of query execution IDs for the primary workgroup. Requires you to have access to the - * workgroup in which the queries ran. - * - * For code samples using the Amazon Web Services SDK for Java, see Examples and Code Samples [^1] in the *Amazon Athena - * User Guide*. - * - * [^1]: http://docs.aws.amazon.com/athena/latest/ug/code-samples.html + * Provides a list of available query execution IDs for the queries in the specified workgroup. Athena keeps a query + * history for 45 days. If a workgroup is not specified, returns a list of query execution IDs for the primary + * workgroup. Requires you to have access to the workgroup in which the queries ran. * * @see https://docs.aws.amazon.com/athena/latest/APIReference/API_ListQueryExecutions.html * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-athena-2017-05-18.html#listqueryexecutions @@ -504,6 +494,10 @@ public function listTableMetadata($input): ListTableMetadataOutput * Submits calculations for execution within a session. You can supply the code to run as an inline code block within * the request. * + * > The request syntax requires the StartCalculationExecutionRequest$CodeBlock parameter or the + * > CalculationConfiguration$CodeBlock parameter, but not both. Because CalculationConfiguration$CodeBlock is + * > deprecated, use the StartCalculationExecutionRequest$CodeBlock parameter instead. + * * @see https://docs.aws.amazon.com/athena/latest/APIReference/API_StartCalculationExecution.html * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-athena-2017-05-18.html#startcalculationexecution * @@ -641,11 +635,6 @@ public function stopCalculationExecution($input): StopCalculationExecutionRespon /** * Stops a query execution. Requires you to have access to the workgroup in which the query ran. * - * For code samples using the Amazon Web Services SDK for Java, see Examples and Code Samples [^1] in the *Amazon Athena - * User Guide*. - * - * [^1]: http://docs.aws.amazon.com/athena/latest/ug/code-samples.html - * * @see https://docs.aws.amazon.com/athena/latest/APIReference/API_StopQueryExecution.html * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-athena-2017-05-18.html#stopqueryexecution * diff --git a/src/Service/Athena/src/Input/StartCalculationExecutionRequest.php b/src/Service/Athena/src/Input/StartCalculationExecutionRequest.php index ae642549c..bff3592b5 100644 --- a/src/Service/Athena/src/Input/StartCalculationExecutionRequest.php +++ b/src/Service/Athena/src/Input/StartCalculationExecutionRequest.php @@ -34,7 +34,8 @@ final class StartCalculationExecutionRequest extends Input private $calculationConfiguration; /** - * A string that contains the code of the calculation. + * A string that contains the code of the calculation. Use this parameter instead of CalculationConfiguration$CodeBlock, + * which is deprecated. * * @var string|null */ diff --git a/src/Service/Athena/src/Result/GetQueryExecutionOutput.php b/src/Service/Athena/src/Result/GetQueryExecutionOutput.php index 9187e38d0..369e743cd 100644 --- a/src/Service/Athena/src/Result/GetQueryExecutionOutput.php +++ b/src/Service/Athena/src/Result/GetQueryExecutionOutput.php @@ -123,6 +123,7 @@ private function populateResultQueryExecutionStatistics(array $json): QueryExecu 'DataManifestLocation' => isset($json['DataManifestLocation']) ? (string) $json['DataManifestLocation'] : null, 'TotalExecutionTimeInMillis' => isset($json['TotalExecutionTimeInMillis']) ? (int) $json['TotalExecutionTimeInMillis'] : null, 'QueryQueueTimeInMillis' => isset($json['QueryQueueTimeInMillis']) ? (int) $json['QueryQueueTimeInMillis'] : null, + 'ServicePreProcessingTimeInMillis' => isset($json['ServicePreProcessingTimeInMillis']) ? (int) $json['ServicePreProcessingTimeInMillis'] : null, 'QueryPlanningTimeInMillis' => isset($json['QueryPlanningTimeInMillis']) ? (int) $json['QueryPlanningTimeInMillis'] : null, 'ServiceProcessingTimeInMillis' => isset($json['ServiceProcessingTimeInMillis']) ? (int) $json['ServiceProcessingTimeInMillis'] : null, 'ResultReuseInformation' => empty($json['ResultReuseInformation']) ? null : $this->populateResultResultReuseInformation($json['ResultReuseInformation']), diff --git a/src/Service/Athena/src/ValueObject/CustomerContentEncryptionConfiguration.php b/src/Service/Athena/src/ValueObject/CustomerContentEncryptionConfiguration.php index 2bcb05b48..b134f5e71 100644 --- a/src/Service/Athena/src/ValueObject/CustomerContentEncryptionConfiguration.php +++ b/src/Service/Athena/src/ValueObject/CustomerContentEncryptionConfiguration.php @@ -5,13 +5,13 @@ use AsyncAws\Core\Exception\InvalidArgument; /** - * Specifies the KMS key that is used to encrypt the user's data stores in Athena. This setting does not apply to Athena - * SQL workgroups. + * Specifies the customer managed KMS key that is used to encrypt the user's data stores in Athena. When an Amazon Web + * Services managed key is used, this value is null. This setting does not apply to Athena SQL workgroups. */ final class CustomerContentEncryptionConfiguration { /** - * The KMS key that is used to encrypt the user's data stores in Athena. + * The customer managed KMS key that is used to encrypt the user's data stores in Athena. * * @var string */ diff --git a/src/Service/Athena/src/ValueObject/DataCatalog.php b/src/Service/Athena/src/ValueObject/DataCatalog.php index d52df488e..7e0455e57 100644 --- a/src/Service/Athena/src/ValueObject/DataCatalog.php +++ b/src/Service/Athena/src/ValueObject/DataCatalog.php @@ -63,8 +63,6 @@ final class DataCatalog * * - The `GLUE` data catalog type also applies to the default `AwsDataCatalog` that already exists in your account, of * which you can have only one and cannot modify. - * - Queries that specify a Glue Data Catalog other than the default `AwsDataCatalog` must be run on Athena engine - * version 2. * * @var array|null */ diff --git a/src/Service/Athena/src/ValueObject/QueryExecutionStatistics.php b/src/Service/Athena/src/ValueObject/QueryExecutionStatistics.php index 31d592dc5..43cc17039 100644 --- a/src/Service/Athena/src/ValueObject/QueryExecutionStatistics.php +++ b/src/Service/Athena/src/ValueObject/QueryExecutionStatistics.php @@ -50,6 +50,13 @@ final class QueryExecutionStatistics */ private $queryQueueTimeInMillis; + /** + * The number of milliseconds that Athena took to preprocess the query before submitting the query to the query engine. + * + * @var int|null + */ + private $servicePreProcessingTimeInMillis; + /** * The number of milliseconds that Athena took to plan the query processing flow. This includes the time spent * retrieving table partitions from the data source. Note that because the query engine performs the query planning, @@ -81,6 +88,7 @@ final class QueryExecutionStatistics * DataManifestLocation?: null|string, * TotalExecutionTimeInMillis?: null|int, * QueryQueueTimeInMillis?: null|int, + * ServicePreProcessingTimeInMillis?: null|int, * QueryPlanningTimeInMillis?: null|int, * ServiceProcessingTimeInMillis?: null|int, * ResultReuseInformation?: null|ResultReuseInformation|array, @@ -93,6 +101,7 @@ public function __construct(array $input) $this->dataManifestLocation = $input['DataManifestLocation'] ?? null; $this->totalExecutionTimeInMillis = $input['TotalExecutionTimeInMillis'] ?? null; $this->queryQueueTimeInMillis = $input['QueryQueueTimeInMillis'] ?? null; + $this->servicePreProcessingTimeInMillis = $input['ServicePreProcessingTimeInMillis'] ?? null; $this->queryPlanningTimeInMillis = $input['QueryPlanningTimeInMillis'] ?? null; $this->serviceProcessingTimeInMillis = $input['ServiceProcessingTimeInMillis'] ?? null; $this->resultReuseInformation = isset($input['ResultReuseInformation']) ? ResultReuseInformation::create($input['ResultReuseInformation']) : null; @@ -105,6 +114,7 @@ public function __construct(array $input) * DataManifestLocation?: null|string, * TotalExecutionTimeInMillis?: null|int, * QueryQueueTimeInMillis?: null|int, + * ServicePreProcessingTimeInMillis?: null|int, * QueryPlanningTimeInMillis?: null|int, * ServiceProcessingTimeInMillis?: null|int, * ResultReuseInformation?: null|ResultReuseInformation|array, @@ -145,6 +155,11 @@ public function getResultReuseInformation(): ?ResultReuseInformation return $this->resultReuseInformation; } + public function getServicePreProcessingTimeInMillis(): ?int + { + return $this->servicePreProcessingTimeInMillis; + } + public function getServiceProcessingTimeInMillis(): ?int { return $this->serviceProcessingTimeInMillis; diff --git a/src/Service/Athena/src/ValueObject/SessionConfiguration.php b/src/Service/Athena/src/ValueObject/SessionConfiguration.php index 12727662f..0c4c89ecf 100644 --- a/src/Service/Athena/src/ValueObject/SessionConfiguration.php +++ b/src/Service/Athena/src/ValueObject/SessionConfiguration.php @@ -8,7 +8,8 @@ final class SessionConfiguration { /** - * The ARN of the execution role used for the session. + * The ARN of the execution role used in a Spark session to access user resources. This property applies only to + * Spark-enabled workgroups. * * @var string|null */ diff --git a/src/Service/Athena/src/ValueObject/WorkGroupConfiguration.php b/src/Service/Athena/src/ValueObject/WorkGroupConfiguration.php index 0c00b45ee..35091fa1a 100644 --- a/src/Service/Athena/src/ValueObject/WorkGroupConfiguration.php +++ b/src/Service/Athena/src/ValueObject/WorkGroupConfiguration.php @@ -78,7 +78,8 @@ final class WorkGroupConfiguration private $additionalConfiguration; /** - * Role used in a session for accessing the user's resources. + * Role used in a Spark session for accessing the user's resources. This property applies only to Spark-enabled + * workgroups. * * @var string|null */ diff --git a/src/Service/CloudFormation/src/CloudFormationClient.php b/src/Service/CloudFormation/src/CloudFormationClient.php index 37f1f13d1..b69858bf5 100644 --- a/src/Service/CloudFormation/src/CloudFormationClient.php +++ b/src/Service/CloudFormation/src/CloudFormationClient.php @@ -49,7 +49,7 @@ public function describeStackDriftDetectionStatus($input): DescribeStackDriftDet /** * Returns all stack related events for a specified stack in reverse chronological order. For more information about a - * stack's event history, go to Stacks [^1] in the CloudFormation User Guide. + * stack's event history, go to Stacks [^1] in the *CloudFormation User Guide*. * * > You can list events for stacks that have failed to create or have been deleted by specifying the unique stack * > identifier (stack ID). @@ -77,7 +77,7 @@ public function describeStackEvents($input = []): DescribeStackEventsOutput * Returns the description for the specified stack; if no stack name was specified, then it returns the description for * all the stacks created. * - * > If the stack doesn't exist, an `ValidationError` is returned. + * > If the stack doesn't exist, a `ValidationError` is returned. * * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_DescribeStacks.html * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-cloudformation-2010-05-15.html#describestacks diff --git a/src/Service/EventBridge/CHANGELOG.md b/src/Service/EventBridge/CHANGELOG.md index d3b32801b..e86a4b21f 100644 --- a/src/Service/EventBridge/CHANGELOG.md +++ b/src/Service/EventBridge/CHANGELOG.md @@ -2,6 +2,10 @@ ## NOT RELEASED +### Added + +- AWS api-change: Introduces a new rule state ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS for matching with Get, List and Describe AWS API call events from CloudTrail. + ### Changed - Allow passing explicit null values for optional fields of input objects diff --git a/src/Service/EventBridge/src/EventBridgeClient.php b/src/Service/EventBridge/src/EventBridgeClient.php index a362b20cf..68ce17b32 100644 --- a/src/Service/EventBridge/src/EventBridgeClient.php +++ b/src/Service/EventBridge/src/EventBridgeClient.php @@ -17,8 +17,17 @@ class EventBridgeClient extends AbstractApi /** * Sends custom events to Amazon EventBridge so that they can be matched to rules. * + * The maximum size for a PutEvents event entry is 256 KB. Entry size is calculated including the event and any + * necessary characters and keys of the JSON representation of the event. To learn more, see Calculating PutEvents event + * entry size [^1] in the *Amazon EventBridge User Guide* + * + * PutEvents accepts the data in JSON format. For the JSON number (integer) data type, the constraints are: a minimum + * value of -9,223,372,036,854,775,808 and a maximum value of 9,223,372,036,854,775,807. + * * > PutEvents will only process nested JSON up to 1100 levels deep. * + * [^1]: https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-putevent-size.html + * * @see https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_PutEvents.html * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-events-2015-10-07.html#putevents * diff --git a/src/Service/EventBridge/src/ValueObject/PutEventsRequestEntry.php b/src/Service/EventBridge/src/ValueObject/PutEventsRequestEntry.php index e7c06c6e5..2f99b3dae 100644 --- a/src/Service/EventBridge/src/ValueObject/PutEventsRequestEntry.php +++ b/src/Service/EventBridge/src/ValueObject/PutEventsRequestEntry.php @@ -21,6 +21,11 @@ final class PutEventsRequestEntry /** * The source of the event. * + * > `Detail`, `DetailType`, and `Source` are required for EventBridge to successfully send an event to an event bus. If + * > you include event entries in a request that do not include each of those properties, EventBridge fails that entry. + * > If you submit a request in which *none* of the entries have each of these properties, EventBridge fails the entire + * > request. + * * @var string|null */ private $source; @@ -36,12 +41,22 @@ final class PutEventsRequestEntry /** * Free-form string, with a maximum of 128 characters, used to decide what fields to expect in the event detail. * + * > `Detail`, `DetailType`, and `Source` are required for EventBridge to successfully send an event to an event bus. If + * > you include event entries in a request that do not include each of those properties, EventBridge fails that entry. + * > If you submit a request in which *none* of the entries have each of these properties, EventBridge fails the entire + * > request. + * * @var string|null */ private $detailType; /** - * A valid JSON object. There is no other schema imposed. The JSON object may contain fields and nested subobjects. + * A valid JSON object. There is no other schema imposed. The JSON object may contain fields and nested sub-objects. + * + * > `Detail`, `DetailType`, and `Source` are required for EventBridge to successfully send an event to an event bus. If + * > you include event entries in a request that do not include each of those properties, EventBridge fails that entry. + * > If you submit a request in which *none* of the entries have each of these properties, EventBridge fails the entire + * > request. * * @var string|null */ @@ -51,9 +66,10 @@ final class PutEventsRequestEntry * The name or ARN of the event bus to receive the event. Only the rules that are associated with this event bus are * used to match the event. If you omit this, the default event bus is used. * - * > If you're using a global endpoint with a custom bus, you must enter the name, not the ARN, of the event bus in - * > either the primary or secondary Region here and the corresponding event bus in the other Region will be determined - * > based on the endpoint referenced by the `EndpointId`. + * > If you're using a global endpoint with a custom bus, you can enter either the name or Amazon Resource Name (ARN) of + * > the event bus in either the primary or secondary Region here. EventBridge then determines the corresponding event + * > bus in the other Region based on the endpoint referenced by the `EndpointId`. Specifying the event bus ARN is + * > preferred. * * @var string|null */ diff --git a/src/Service/EventBridge/src/ValueObject/PutEventsResultEntry.php b/src/Service/EventBridge/src/ValueObject/PutEventsResultEntry.php index fa57d2243..ad3999568 100644 --- a/src/Service/EventBridge/src/ValueObject/PutEventsResultEntry.php +++ b/src/Service/EventBridge/src/ValueObject/PutEventsResultEntry.php @@ -2,9 +2,15 @@ namespace AsyncAws\EventBridge\ValueObject; +use AsyncAws\Core\Exception\InvalidArgument; + /** - * Represents an event that failed to be submitted. For information about the errors that are common to all actions, see - * Common Errors [^1]. + * Represents the results of an event submitted to an event bus. + * + * If the submission was successful, the entry has the event ID in it. Otherwise, you can use the error code and error + * message to identify the problem with the entry. + * + * For information about the errors that are common to all actions, see Common Errors [^1]. * * [^1]: https://docs.aws.amazon.com/eventbridge/latest/APIReference/CommonErrors.html */ @@ -20,6 +26,43 @@ final class PutEventsResultEntry /** * The error code that indicates why the event submission failed. * + * Retryable errors include: + * + * - `InternalFailure [^1]` + * + * The request processing has failed because of an unknown error, exception or failure. + * - `ThrottlingException [^2]` + * + * The request was denied due to request throttling. + * + * Non-retryable errors include: + * + * - `AccessDeniedException [^3]` + * + * You do not have sufficient access to perform this action. + * - `InvalidAccountIdException` + * + * The account ID provided is not valid. + * - `InvalidArgument` + * + * A specified parameter is not valid. + * - `MalformedDetail` + * + * The JSON provided is not valid. + * - `RedactionFailure` + * + * Redacting the CloudTrail event failed. + * - `NotAuthorizedForSourceException` + * + * You do not have permissions to publish events with this source onto this event bus. + * - `NotAuthorizedForDetailTypeException` + * + * You do not have permissions to publish events with this detail type onto this event bus. + * + * [^1]: https://docs.aws.amazon.com/eventbridge/latest/APIReference/CommonErrors.html + * [^2]: https://docs.aws.amazon.com/eventbridge/latest/APIReference/CommonErrors.html + * [^3]: https://docs.aws.amazon.com/eventbridge/latest/APIReference/CommonErrors.html + * * @var string|null */ private $errorCode; diff --git a/src/Service/Iot/CHANGELOG.md b/src/Service/Iot/CHANGELOG.md index 46d94b4e7..808cd5c71 100644 --- a/src/Service/Iot/CHANGELOG.md +++ b/src/Service/Iot/CHANGELOG.md @@ -5,6 +5,7 @@ ### Changed - Allow passing explicit null values for optional fields of input objects +- AWS enhancement: Documentation updates. ## 2.0.0 diff --git a/src/Service/Iot/src/IotClient.php b/src/Service/Iot/src/IotClient.php index f317861df..b4f4230a1 100644 --- a/src/Service/Iot/src/IotClient.php +++ b/src/Service/Iot/src/IotClient.php @@ -134,6 +134,9 @@ public function createThing($input): CreateThingResponse * Create a thing group. * * > This is a control plane operation. See Authorization [^1] for information about authorizing control plane actions. + * > + * > If the `ThingGroup` that you create has the exact same attributes as an existing `ThingGroup`, you will get a 200 + * > success response. * * Requires permission to access the CreateThingGroup [^2] action. * diff --git a/src/Service/Lambda/CHANGELOG.md b/src/Service/Lambda/CHANGELOG.md index a64d1d8ba..ce759f3e0 100644 --- a/src/Service/Lambda/CHANGELOG.md +++ b/src/Service/Lambda/CHANGELOG.md @@ -5,6 +5,11 @@ ### Added - AWS api-change: Adds support for Lambda functions to access Dual-Stack subnets over IPv6, via an opt-in flag in CreateFunction and UpdateFunctionConfiguration APIs +- AWS api-change: Adds support for logging configuration in Lambda Functions. Customers will have more control how their function logs are captured and to which cloud watch log group they are delivered also. +- AWS api-change: Add Java 21 (java21) support to AWS Lambda +- AWS api-change: Add Python 3.12 (python3.12) support to AWS Lambda +- AWS api-change: Add Custom runtime on Amazon Linux 2023 (provided.al2023) support to AWS Lambda. +- AWS api-change: Add Node 20 (nodejs20.x) support to AWS Lambda. ## 2.1.0 diff --git a/src/Service/Lambda/src/Enum/ApplicationLogLevel.php b/src/Service/Lambda/src/Enum/ApplicationLogLevel.php new file mode 100644 index 000000000..2ee101387 --- /dev/null +++ b/src/Service/Lambda/src/Enum/ApplicationLogLevel.php @@ -0,0 +1,25 @@ + true, + self::ERROR => true, + self::FATAL => true, + self::INFO => true, + self::TRACE => true, + self::WARN => true, + ][$value]); + } +} diff --git a/src/Service/Lambda/src/Enum/LogFormat.php b/src/Service/Lambda/src/Enum/LogFormat.php new file mode 100644 index 000000000..ed250cded --- /dev/null +++ b/src/Service/Lambda/src/Enum/LogFormat.php @@ -0,0 +1,17 @@ + true, + self::TEXT => true, + ][$value]); + } +} diff --git a/src/Service/Lambda/src/Enum/Runtime.php b/src/Service/Lambda/src/Enum/Runtime.php index 2d86825ac..49cc52509 100644 --- a/src/Service/Lambda/src/Enum/Runtime.php +++ b/src/Service/Lambda/src/Enum/Runtime.php @@ -12,6 +12,7 @@ final class Runtime public const GO_1_X = 'go1.x'; public const JAVA_11 = 'java11'; public const JAVA_17 = 'java17'; + public const JAVA_21 = 'java21'; public const JAVA_8 = 'java8'; public const JAVA_8_AL_2 = 'java8.al2'; public const NODEJS = 'nodejs'; @@ -20,15 +21,18 @@ final class Runtime public const NODEJS_14_X = 'nodejs14.x'; public const NODEJS_16_X = 'nodejs16.x'; public const NODEJS_18_X = 'nodejs18.x'; + public const NODEJS_20_X = 'nodejs20.x'; public const NODEJS_4_3 = 'nodejs4.3'; public const NODEJS_4_3_EDGE = 'nodejs4.3-edge'; public const NODEJS_6_10 = 'nodejs6.10'; public const NODEJS_8_10 = 'nodejs8.10'; public const PROVIDED = 'provided'; public const PROVIDED_AL_2 = 'provided.al2'; + public const PROVIDED_AL_2023 = 'provided.al2023'; public const PYTHON_2_7 = 'python2.7'; public const PYTHON_3_10 = 'python3.10'; public const PYTHON_3_11 = 'python3.11'; + public const PYTHON_3_12 = 'python3.12'; public const PYTHON_3_6 = 'python3.6'; public const PYTHON_3_7 = 'python3.7'; public const PYTHON_3_8 = 'python3.8'; @@ -48,6 +52,7 @@ public static function exists(string $value): bool self::GO_1_X => true, self::JAVA_11 => true, self::JAVA_17 => true, + self::JAVA_21 => true, self::JAVA_8 => true, self::JAVA_8_AL_2 => true, self::NODEJS => true, @@ -56,15 +61,18 @@ public static function exists(string $value): bool self::NODEJS_14_X => true, self::NODEJS_16_X => true, self::NODEJS_18_X => true, + self::NODEJS_20_X => true, self::NODEJS_4_3 => true, self::NODEJS_4_3_EDGE => true, self::NODEJS_6_10 => true, self::NODEJS_8_10 => true, self::PROVIDED => true, self::PROVIDED_AL_2 => true, + self::PROVIDED_AL_2023 => true, self::PYTHON_2_7 => true, self::PYTHON_3_10 => true, self::PYTHON_3_11 => true, + self::PYTHON_3_12 => true, self::PYTHON_3_6 => true, self::PYTHON_3_7 => true, self::PYTHON_3_8 => true, diff --git a/src/Service/Lambda/src/Enum/SystemLogLevel.php b/src/Service/Lambda/src/Enum/SystemLogLevel.php new file mode 100644 index 000000000..49cff1ca7 --- /dev/null +++ b/src/Service/Lambda/src/Enum/SystemLogLevel.php @@ -0,0 +1,19 @@ + true, + self::INFO => true, + self::WARN => true, + ][$value]); + } +} diff --git a/src/Service/Lambda/src/Input/UpdateFunctionConfigurationRequest.php b/src/Service/Lambda/src/Input/UpdateFunctionConfigurationRequest.php index 6c0f95ef9..a5a2e37cf 100644 --- a/src/Service/Lambda/src/Input/UpdateFunctionConfigurationRequest.php +++ b/src/Service/Lambda/src/Input/UpdateFunctionConfigurationRequest.php @@ -12,6 +12,7 @@ use AsyncAws\Lambda\ValueObject\EphemeralStorage; use AsyncAws\Lambda\ValueObject\FileSystemConfig; use AsyncAws\Lambda\ValueObject\ImageConfig; +use AsyncAws\Lambda\ValueObject\LoggingConfig; use AsyncAws\Lambda\ValueObject\SnapStart; use AsyncAws\Lambda\ValueObject\TracingConfig; use AsyncAws\Lambda\ValueObject\VpcConfig; @@ -196,6 +197,13 @@ final class UpdateFunctionConfigurationRequest extends Input */ private $snapStart; + /** + * The function's Amazon CloudWatch Logs configuration settings. + * + * @var LoggingConfig|null + */ + private $loggingConfig; + /** * @param array{ * FunctionName?: string, @@ -216,6 +224,7 @@ final class UpdateFunctionConfigurationRequest extends Input * ImageConfig?: null|ImageConfig|array, * EphemeralStorage?: null|EphemeralStorage|array, * SnapStart?: null|SnapStart|array, + * LoggingConfig?: null|LoggingConfig|array, * '@region'?: string|null, * } $input */ @@ -239,6 +248,7 @@ public function __construct(array $input = []) $this->imageConfig = isset($input['ImageConfig']) ? ImageConfig::create($input['ImageConfig']) : null; $this->ephemeralStorage = isset($input['EphemeralStorage']) ? EphemeralStorage::create($input['EphemeralStorage']) : null; $this->snapStart = isset($input['SnapStart']) ? SnapStart::create($input['SnapStart']) : null; + $this->loggingConfig = isset($input['LoggingConfig']) ? LoggingConfig::create($input['LoggingConfig']) : null; parent::__construct($input); } @@ -262,6 +272,7 @@ public function __construct(array $input = []) * ImageConfig?: null|ImageConfig|array, * EphemeralStorage?: null|EphemeralStorage|array, * SnapStart?: null|SnapStart|array, + * LoggingConfig?: null|LoggingConfig|array, * '@region'?: string|null, * }|UpdateFunctionConfigurationRequest $input */ @@ -326,6 +337,11 @@ public function getLayers(): array return $this->layers ?? []; } + public function getLoggingConfig(): ?LoggingConfig + { + return $this->loggingConfig; + } + public function getMemorySize(): ?int { return $this->memorySize; @@ -472,6 +488,13 @@ public function setLayers(array $value): self return $this; } + public function setLoggingConfig(?LoggingConfig $value): self + { + $this->loggingConfig = $value; + + return $this; + } + public function setMemorySize(?int $value): self { $this->memorySize = $value; @@ -599,6 +622,9 @@ private function requestBody(): array if (null !== $v = $this->snapStart) { $payload['SnapStart'] = $v->requestBody(); } + if (null !== $v = $this->loggingConfig) { + $payload['LoggingConfig'] = $v->requestBody(); + } return $payload; } diff --git a/src/Service/Lambda/src/LambdaClient.php b/src/Service/Lambda/src/LambdaClient.php index 9b94b0c32..117fe37c4 100644 --- a/src/Service/Lambda/src/LambdaClient.php +++ b/src/Service/Lambda/src/LambdaClient.php @@ -72,6 +72,7 @@ use AsyncAws\Lambda\ValueObject\FileSystemConfig; use AsyncAws\Lambda\ValueObject\ImageConfig; use AsyncAws\Lambda\ValueObject\LayerVersionContentInput; +use AsyncAws\Lambda\ValueObject\LoggingConfig; use AsyncAws\Lambda\ValueObject\SnapStart; use AsyncAws\Lambda\ValueObject\TracingConfig; use AsyncAws\Lambda\ValueObject\VpcConfig; @@ -196,8 +197,10 @@ public function getFunctionConfiguration($input): FunctionConfiguration } /** - * Invokes a Lambda function. You can invoke a function synchronously (and wait for the response), or asynchronously. To - * invoke a function asynchronously, set `InvocationType` to `Event`. + * Invokes a Lambda function. You can invoke a function synchronously (and wait for the response), or asynchronously. By + * default, Lambda invokes your function synchronously (i.e. the`InvocationType` is `RequestResponse`). To invoke a + * function asynchronously, set `InvocationType` to `Event`. Lambda passes the `ClientContext` object to your function + * for synchronous invocations only. * * For synchronous invocation [^1], details about the function response, including errors, are included in the response * body and headers. For either invocation type, you can find more information in the execution log [^2] and trace [^3]. @@ -508,6 +511,7 @@ public function publishLayerVersion($input): PublishLayerVersionResponse * ImageConfig?: null|ImageConfig|array, * EphemeralStorage?: null|EphemeralStorage|array, * SnapStart?: null|SnapStart|array, + * LoggingConfig?: null|LoggingConfig|array, * '@region'?: string|null, * }|UpdateFunctionConfigurationRequest $input * diff --git a/src/Service/Lambda/src/Result/FunctionConfiguration.php b/src/Service/Lambda/src/Result/FunctionConfiguration.php index 5285d32bc..d679bfa5a 100644 --- a/src/Service/Lambda/src/Result/FunctionConfiguration.php +++ b/src/Service/Lambda/src/Result/FunctionConfiguration.php @@ -20,6 +20,7 @@ use AsyncAws\Lambda\ValueObject\ImageConfigError; use AsyncAws\Lambda\ValueObject\ImageConfigResponse; use AsyncAws\Lambda\ValueObject\Layer; +use AsyncAws\Lambda\ValueObject\LoggingConfig; use AsyncAws\Lambda\ValueObject\RuntimeVersionConfig; use AsyncAws\Lambda\ValueObject\RuntimeVersionError; use AsyncAws\Lambda\ValueObject\SnapStartResponse; @@ -301,6 +302,13 @@ class FunctionConfiguration extends Result */ private $runtimeVersionConfig; + /** + * The function's Amazon CloudWatch Logs configuration settings. + * + * @var LoggingConfig|null + */ + private $loggingConfig; + /** * @return list */ @@ -442,6 +450,13 @@ public function getLayers(): array return $this->layers; } + public function getLoggingConfig(): ?LoggingConfig + { + $this->initialize(); + + return $this->loggingConfig; + } + public function getMasterArn(): ?string { $this->initialize(); @@ -612,6 +627,7 @@ protected function populateResult(Response $response): void $this->ephemeralStorage = empty($data['EphemeralStorage']) ? null : $this->populateResultEphemeralStorage($data['EphemeralStorage']); $this->snapStart = empty($data['SnapStart']) ? null : $this->populateResultSnapStartResponse($data['SnapStart']); $this->runtimeVersionConfig = empty($data['RuntimeVersionConfig']) ? null : $this->populateResultRuntimeVersionConfig($data['RuntimeVersionConfig']); + $this->loggingConfig = empty($data['LoggingConfig']) ? null : $this->populateResultLoggingConfig($data['LoggingConfig']); } /** @@ -742,6 +758,16 @@ private function populateResultLayersReferenceList(array $json): array return $items; } + private function populateResultLoggingConfig(array $json): LoggingConfig + { + return new LoggingConfig([ + 'LogFormat' => isset($json['LogFormat']) ? (string) $json['LogFormat'] : null, + 'ApplicationLogLevel' => isset($json['ApplicationLogLevel']) ? (string) $json['ApplicationLogLevel'] : null, + 'SystemLogLevel' => isset($json['SystemLogLevel']) ? (string) $json['SystemLogLevel'] : null, + 'LogGroup' => isset($json['LogGroup']) ? (string) $json['LogGroup'] : null, + ]); + } + private function populateResultRuntimeVersionConfig(array $json): RuntimeVersionConfig { return new RuntimeVersionConfig([ diff --git a/src/Service/Lambda/src/Result/ListFunctionsResponse.php b/src/Service/Lambda/src/Result/ListFunctionsResponse.php index 031bb7a60..e13edd1c2 100644 --- a/src/Service/Lambda/src/Result/ListFunctionsResponse.php +++ b/src/Service/Lambda/src/Result/ListFunctionsResponse.php @@ -18,6 +18,7 @@ use AsyncAws\Lambda\ValueObject\ImageConfigError; use AsyncAws\Lambda\ValueObject\ImageConfigResponse; use AsyncAws\Lambda\ValueObject\Layer; +use AsyncAws\Lambda\ValueObject\LoggingConfig; use AsyncAws\Lambda\ValueObject\RuntimeVersionConfig; use AsyncAws\Lambda\ValueObject\RuntimeVersionError; use AsyncAws\Lambda\ValueObject\SnapStartResponse; @@ -232,6 +233,7 @@ private function populateResultFunctionConfiguration(array $json): FunctionConfi 'EphemeralStorage' => empty($json['EphemeralStorage']) ? null : $this->populateResultEphemeralStorage($json['EphemeralStorage']), 'SnapStart' => empty($json['SnapStart']) ? null : $this->populateResultSnapStartResponse($json['SnapStart']), 'RuntimeVersionConfig' => empty($json['RuntimeVersionConfig']) ? null : $this->populateResultRuntimeVersionConfig($json['RuntimeVersionConfig']), + 'LoggingConfig' => empty($json['LoggingConfig']) ? null : $this->populateResultLoggingConfig($json['LoggingConfig']), ]); } @@ -296,6 +298,16 @@ private function populateResultLayersReferenceList(array $json): array return $items; } + private function populateResultLoggingConfig(array $json): LoggingConfig + { + return new LoggingConfig([ + 'LogFormat' => isset($json['LogFormat']) ? (string) $json['LogFormat'] : null, + 'ApplicationLogLevel' => isset($json['ApplicationLogLevel']) ? (string) $json['ApplicationLogLevel'] : null, + 'SystemLogLevel' => isset($json['SystemLogLevel']) ? (string) $json['SystemLogLevel'] : null, + 'LogGroup' => isset($json['LogGroup']) ? (string) $json['LogGroup'] : null, + ]); + } + private function populateResultRuntimeVersionConfig(array $json): RuntimeVersionConfig { return new RuntimeVersionConfig([ diff --git a/src/Service/Lambda/src/Result/ListVersionsByFunctionResponse.php b/src/Service/Lambda/src/Result/ListVersionsByFunctionResponse.php index 24fa42e47..136da1efa 100644 --- a/src/Service/Lambda/src/Result/ListVersionsByFunctionResponse.php +++ b/src/Service/Lambda/src/Result/ListVersionsByFunctionResponse.php @@ -18,6 +18,7 @@ use AsyncAws\Lambda\ValueObject\ImageConfigError; use AsyncAws\Lambda\ValueObject\ImageConfigResponse; use AsyncAws\Lambda\ValueObject\Layer; +use AsyncAws\Lambda\ValueObject\LoggingConfig; use AsyncAws\Lambda\ValueObject\RuntimeVersionConfig; use AsyncAws\Lambda\ValueObject\RuntimeVersionError; use AsyncAws\Lambda\ValueObject\SnapStartResponse; @@ -230,6 +231,7 @@ private function populateResultFunctionConfiguration(array $json): FunctionConfi 'EphemeralStorage' => empty($json['EphemeralStorage']) ? null : $this->populateResultEphemeralStorage($json['EphemeralStorage']), 'SnapStart' => empty($json['SnapStart']) ? null : $this->populateResultSnapStartResponse($json['SnapStart']), 'RuntimeVersionConfig' => empty($json['RuntimeVersionConfig']) ? null : $this->populateResultRuntimeVersionConfig($json['RuntimeVersionConfig']), + 'LoggingConfig' => empty($json['LoggingConfig']) ? null : $this->populateResultLoggingConfig($json['LoggingConfig']), ]); } @@ -294,6 +296,16 @@ private function populateResultLayersReferenceList(array $json): array return $items; } + private function populateResultLoggingConfig(array $json): LoggingConfig + { + return new LoggingConfig([ + 'LogFormat' => isset($json['LogFormat']) ? (string) $json['LogFormat'] : null, + 'ApplicationLogLevel' => isset($json['ApplicationLogLevel']) ? (string) $json['ApplicationLogLevel'] : null, + 'SystemLogLevel' => isset($json['SystemLogLevel']) ? (string) $json['SystemLogLevel'] : null, + 'LogGroup' => isset($json['LogGroup']) ? (string) $json['LogGroup'] : null, + ]); + } + private function populateResultRuntimeVersionConfig(array $json): RuntimeVersionConfig { return new RuntimeVersionConfig([ diff --git a/src/Service/Lambda/src/ValueObject/FunctionConfiguration.php b/src/Service/Lambda/src/ValueObject/FunctionConfiguration.php index 1375e9881..83a9d40db 100644 --- a/src/Service/Lambda/src/ValueObject/FunctionConfiguration.php +++ b/src/Service/Lambda/src/ValueObject/FunctionConfiguration.php @@ -285,6 +285,13 @@ final class FunctionConfiguration */ private $runtimeVersionConfig; + /** + * The function's Amazon CloudWatch Logs configuration settings. + * + * @var LoggingConfig|null + */ + private $loggingConfig; + /** * @param array{ * FunctionName?: null|string, @@ -322,6 +329,7 @@ final class FunctionConfiguration * EphemeralStorage?: null|EphemeralStorage|array, * SnapStart?: null|SnapStartResponse|array, * RuntimeVersionConfig?: null|RuntimeVersionConfig|array, + * LoggingConfig?: null|LoggingConfig|array, * } $input */ public function __construct(array $input) @@ -361,6 +369,7 @@ public function __construct(array $input) $this->ephemeralStorage = isset($input['EphemeralStorage']) ? EphemeralStorage::create($input['EphemeralStorage']) : null; $this->snapStart = isset($input['SnapStart']) ? SnapStartResponse::create($input['SnapStart']) : null; $this->runtimeVersionConfig = isset($input['RuntimeVersionConfig']) ? RuntimeVersionConfig::create($input['RuntimeVersionConfig']) : null; + $this->loggingConfig = isset($input['LoggingConfig']) ? LoggingConfig::create($input['LoggingConfig']) : null; } /** @@ -400,6 +409,7 @@ public function __construct(array $input) * EphemeralStorage?: null|EphemeralStorage|array, * SnapStart?: null|SnapStartResponse|array, * RuntimeVersionConfig?: null|RuntimeVersionConfig|array, + * LoggingConfig?: null|LoggingConfig|array, * }|FunctionConfiguration $input */ public static function create($input): self @@ -512,6 +522,11 @@ public function getLayers(): array return $this->layers ?? []; } + public function getLoggingConfig(): ?LoggingConfig + { + return $this->loggingConfig; + } + public function getMasterArn(): ?string { return $this->masterArn; diff --git a/src/Service/Lambda/src/ValueObject/LoggingConfig.php b/src/Service/Lambda/src/ValueObject/LoggingConfig.php new file mode 100644 index 000000000..39734ae0a --- /dev/null +++ b/src/Service/Lambda/src/ValueObject/LoggingConfig.php @@ -0,0 +1,136 @@ +`. To use a different log group, enter an existing log + * group or enter a new log group name. + * + * @var string|null + */ + private $logGroup; + + /** + * @param array{ + * LogFormat?: null|LogFormat::*, + * ApplicationLogLevel?: null|ApplicationLogLevel::*, + * SystemLogLevel?: null|SystemLogLevel::*, + * LogGroup?: null|string, + * } $input + */ + public function __construct(array $input) + { + $this->logFormat = $input['LogFormat'] ?? null; + $this->applicationLogLevel = $input['ApplicationLogLevel'] ?? null; + $this->systemLogLevel = $input['SystemLogLevel'] ?? null; + $this->logGroup = $input['LogGroup'] ?? null; + } + + /** + * @param array{ + * LogFormat?: null|LogFormat::*, + * ApplicationLogLevel?: null|ApplicationLogLevel::*, + * SystemLogLevel?: null|SystemLogLevel::*, + * LogGroup?: null|string, + * }|LoggingConfig $input + */ + public static function create($input): self + { + return $input instanceof self ? $input : new self($input); + } + + /** + * @return ApplicationLogLevel::*|null + */ + public function getApplicationLogLevel(): ?string + { + return $this->applicationLogLevel; + } + + /** + * @return LogFormat::*|null + */ + public function getLogFormat(): ?string + { + return $this->logFormat; + } + + public function getLogGroup(): ?string + { + return $this->logGroup; + } + + /** + * @return SystemLogLevel::*|null + */ + public function getSystemLogLevel(): ?string + { + return $this->systemLogLevel; + } + + /** + * @internal + */ + public function requestBody(): array + { + $payload = []; + if (null !== $v = $this->logFormat) { + if (!LogFormat::exists($v)) { + throw new InvalidArgument(sprintf('Invalid parameter "LogFormat" for "%s". The value "%s" is not a valid "LogFormat".', __CLASS__, $v)); + } + $payload['LogFormat'] = $v; + } + if (null !== $v = $this->applicationLogLevel) { + if (!ApplicationLogLevel::exists($v)) { + throw new InvalidArgument(sprintf('Invalid parameter "ApplicationLogLevel" for "%s". The value "%s" is not a valid "ApplicationLogLevel".', __CLASS__, $v)); + } + $payload['ApplicationLogLevel'] = $v; + } + if (null !== $v = $this->systemLogLevel) { + if (!SystemLogLevel::exists($v)) { + throw new InvalidArgument(sprintf('Invalid parameter "SystemLogLevel" for "%s". The value "%s" is not a valid "SystemLogLevel".', __CLASS__, $v)); + } + $payload['SystemLogLevel'] = $v; + } + if (null !== $v = $this->logGroup) { + $payload['LogGroup'] = $v; + } + + return $payload; + } +} diff --git a/src/Service/MediaConvert/CHANGELOG.md b/src/Service/MediaConvert/CHANGELOG.md index 1b3527a24..0ac225e43 100644 --- a/src/Service/MediaConvert/CHANGELOG.md +++ b/src/Service/MediaConvert/CHANGELOG.md @@ -7,6 +7,7 @@ - AWS api-change: This release includes additional audio channel tags in Quicktime outputs, support for film grain synthesis for AV1 outputs, ability to create audio-only FLAC outputs, and ability to specify Amazon S3 destination storage class. - AWS api-change: This release supports the creation of of audio-only tracks in CMAF output groups. - AWS api-change: This release adds the ability to replace video frames without modifying the audio essence. +- AWS api-change: This release includes the ability to specify any input source as the primary input for corresponding follow modes, and allows users to specify fit and fill behaviors without resizing content. ### Changed diff --git a/src/Service/MediaConvert/src/Enum/AudioChannelTag.php b/src/Service/MediaConvert/src/Enum/AudioChannelTag.php index 06f97229a..5a829f113 100644 --- a/src/Service/MediaConvert/src/Enum/AudioChannelTag.php +++ b/src/Service/MediaConvert/src/Enum/AudioChannelTag.php @@ -3,8 +3,10 @@ namespace AsyncAws\MediaConvert\Enum; /** - * You can add a tag for this mono-channel audio track to mimic its placement in a multi-channel layout. For example, if - * this track is the left surround channel, choose Left surround (LS). + * Specify the QuickTime audio channel layout tags for the audio channels in this audio track. Enter channel layout tags + * in the same order as your output's audio channel order. For example, if your output audio track has a left and a + * right channel, enter Left (L) for the first channel and Right (R) for the second. If your output has multiple + * single-channel audio tracks, enter a single channel layout tag for each track. */ final class AudioChannelTag { diff --git a/src/Service/MediaConvert/src/Enum/F4vMoovPlacement.php b/src/Service/MediaConvert/src/Enum/F4vMoovPlacement.php index 4692b56d8..21e191647 100644 --- a/src/Service/MediaConvert/src/Enum/F4vMoovPlacement.php +++ b/src/Service/MediaConvert/src/Enum/F4vMoovPlacement.php @@ -3,8 +3,8 @@ namespace AsyncAws\MediaConvert\Enum; /** - * If set to PROGRESSIVE_DOWNLOAD, the MOOV atom is relocated to the beginning of the archive as required for - * progressive downloading. Otherwise it is placed normally at the end. + * To place the MOOV atom at the beginning of your output, which is useful for progressive downloading: Leave blank or + * choose Progressive download. To place the MOOV at the end of your output: Choose Normal. */ final class F4vMoovPlacement { diff --git a/src/Service/MediaConvert/src/Enum/Mp4MoovPlacement.php b/src/Service/MediaConvert/src/Enum/Mp4MoovPlacement.php index 76b848c4e..e51070dd8 100644 --- a/src/Service/MediaConvert/src/Enum/Mp4MoovPlacement.php +++ b/src/Service/MediaConvert/src/Enum/Mp4MoovPlacement.php @@ -3,8 +3,8 @@ namespace AsyncAws\MediaConvert\Enum; /** - * If set to PROGRESSIVE_DOWNLOAD, the MOOV atom is relocated to the beginning of the archive as required for - * progressive downloading. Otherwise it is placed normally at the end. + * To place the MOOV atom at the beginning of your output, which is useful for progressive downloading: Leave blank or + * choose Progressive download. To place the MOOV at the end of your output: Choose Normal. */ final class Mp4MoovPlacement { diff --git a/src/Service/MediaConvert/src/Enum/ScalingBehavior.php b/src/Service/MediaConvert/src/Enum/ScalingBehavior.php index ab182a63c..a6b6511f3 100644 --- a/src/Service/MediaConvert/src/Enum/ScalingBehavior.php +++ b/src/Service/MediaConvert/src/Enum/ScalingBehavior.php @@ -3,20 +3,24 @@ namespace AsyncAws\MediaConvert\Enum; /** - * Specify how the service handles outputs that have a different aspect ratio from the input aspect ratio. Choose - * Stretch to output to have the service stretch your video image to fit. Keep the setting Default to have the service - * letterbox your video instead. This setting overrides any value that you specify for the setting Selection placement - * in this output. + * Specify the video Scaling behavior when your output has a different resolution than your input. For more information, + * see https://docs.aws.amazon.com/mediaconvert/latest/ug/video-scaling.html. */ final class ScalingBehavior { public const DEFAULT = 'DEFAULT'; + public const FILL = 'FILL'; + public const FIT = 'FIT'; + public const FIT_NO_UPSCALE = 'FIT_NO_UPSCALE'; public const STRETCH_TO_OUTPUT = 'STRETCH_TO_OUTPUT'; public static function exists(string $value): bool { return isset([ self::DEFAULT => true, + self::FILL => true, + self::FIT => true, + self::FIT_NO_UPSCALE => true, self::STRETCH_TO_OUTPUT => true, ][$value]); } diff --git a/src/Service/MediaConvert/src/Result/CreateJobResponse.php b/src/Service/MediaConvert/src/Result/CreateJobResponse.php index a22ccd1c0..6f244f13c 100644 --- a/src/Service/MediaConvert/src/Result/CreateJobResponse.php +++ b/src/Service/MediaConvert/src/Result/CreateJobResponse.php @@ -4,6 +4,7 @@ use AsyncAws\Core\Response; use AsyncAws\Core\Result; +use AsyncAws\MediaConvert\Enum\AudioChannelTag; use AsyncAws\MediaConvert\Enum\HlsAdMarkers; use AsyncAws\MediaConvert\Enum\TeletextPageType; use AsyncAws\MediaConvert\ValueObject\AacSettings; @@ -278,6 +279,7 @@ private function populateResultAudioChannelTaggingSettings(array $json): AudioCh { return new AudioChannelTaggingSettings([ 'ChannelTag' => isset($json['channelTag']) ? (string) $json['channelTag'] : null, + 'ChannelTags' => !isset($json['channelTags']) ? null : $this->populateResult__listOfAudioChannelTag($json['channelTags']), ]); } @@ -1373,6 +1375,7 @@ private function populateResultJobSettings(array $json): JobSettings 'AvailBlanking' => empty($json['availBlanking']) ? null : $this->populateResultAvailBlanking($json['availBlanking']), 'Esam' => empty($json['esam']) ? null : $this->populateResultEsamSettings($json['esam']), 'ExtendedDataServices' => empty($json['extendedDataServices']) ? null : $this->populateResultExtendedDataServices($json['extendedDataServices']), + 'FollowSource' => isset($json['followSource']) ? (int) $json['followSource'] : null, 'Inputs' => !isset($json['inputs']) ? null : $this->populateResult__listOfInput($json['inputs']), 'KantarWatermark' => empty($json['kantarWatermark']) ? null : $this->populateResultKantarWatermarkSettings($json['kantarWatermark']), 'MotionImageInserter' => empty($json['motionImageInserter']) ? null : $this->populateResultMotionImageInserter($json['motionImageInserter']), @@ -2295,6 +2298,22 @@ private function populateResult__listOfAllowedRenditionSize(array $json): array return $items; } + /** + * @return list + */ + private function populateResult__listOfAudioChannelTag(array $json): array + { + $items = []; + foreach ($json as $item) { + $a = isset($item) ? (string) $item : null; + if (null !== $a) { + $items[] = $a; + } + } + + return $items; + } + /** * @return AudioDescription[] */ diff --git a/src/Service/MediaConvert/src/Result/GetJobResponse.php b/src/Service/MediaConvert/src/Result/GetJobResponse.php index b3a6027ce..b4f4f9817 100644 --- a/src/Service/MediaConvert/src/Result/GetJobResponse.php +++ b/src/Service/MediaConvert/src/Result/GetJobResponse.php @@ -4,6 +4,7 @@ use AsyncAws\Core\Response; use AsyncAws\Core\Result; +use AsyncAws\MediaConvert\Enum\AudioChannelTag; use AsyncAws\MediaConvert\Enum\HlsAdMarkers; use AsyncAws\MediaConvert\Enum\TeletextPageType; use AsyncAws\MediaConvert\ValueObject\AacSettings; @@ -278,6 +279,7 @@ private function populateResultAudioChannelTaggingSettings(array $json): AudioCh { return new AudioChannelTaggingSettings([ 'ChannelTag' => isset($json['channelTag']) ? (string) $json['channelTag'] : null, + 'ChannelTags' => !isset($json['channelTags']) ? null : $this->populateResult__listOfAudioChannelTag($json['channelTags']), ]); } @@ -1373,6 +1375,7 @@ private function populateResultJobSettings(array $json): JobSettings 'AvailBlanking' => empty($json['availBlanking']) ? null : $this->populateResultAvailBlanking($json['availBlanking']), 'Esam' => empty($json['esam']) ? null : $this->populateResultEsamSettings($json['esam']), 'ExtendedDataServices' => empty($json['extendedDataServices']) ? null : $this->populateResultExtendedDataServices($json['extendedDataServices']), + 'FollowSource' => isset($json['followSource']) ? (int) $json['followSource'] : null, 'Inputs' => !isset($json['inputs']) ? null : $this->populateResult__listOfInput($json['inputs']), 'KantarWatermark' => empty($json['kantarWatermark']) ? null : $this->populateResultKantarWatermarkSettings($json['kantarWatermark']), 'MotionImageInserter' => empty($json['motionImageInserter']) ? null : $this->populateResultMotionImageInserter($json['motionImageInserter']), @@ -2295,6 +2298,22 @@ private function populateResult__listOfAllowedRenditionSize(array $json): array return $items; } + /** + * @return list + */ + private function populateResult__listOfAudioChannelTag(array $json): array + { + $items = []; + foreach ($json as $item) { + $a = isset($item) ? (string) $item : null; + if (null !== $a) { + $items[] = $a; + } + } + + return $items; + } + /** * @return AudioDescription[] */ diff --git a/src/Service/MediaConvert/src/Result/ListJobsResponse.php b/src/Service/MediaConvert/src/Result/ListJobsResponse.php index 5ab7af289..3db7c0dc1 100644 --- a/src/Service/MediaConvert/src/Result/ListJobsResponse.php +++ b/src/Service/MediaConvert/src/Result/ListJobsResponse.php @@ -5,6 +5,7 @@ use AsyncAws\Core\Exception\InvalidArgument; use AsyncAws\Core\Response; use AsyncAws\Core\Result; +use AsyncAws\MediaConvert\Enum\AudioChannelTag; use AsyncAws\MediaConvert\Enum\HlsAdMarkers; use AsyncAws\MediaConvert\Enum\TeletextPageType; use AsyncAws\MediaConvert\Input\ListJobsRequest; @@ -345,6 +346,7 @@ private function populateResultAudioChannelTaggingSettings(array $json): AudioCh { return new AudioChannelTaggingSettings([ 'ChannelTag' => isset($json['channelTag']) ? (string) $json['channelTag'] : null, + 'ChannelTags' => !isset($json['channelTags']) ? null : $this->populateResult__listOfAudioChannelTag($json['channelTags']), ]); } @@ -1440,6 +1442,7 @@ private function populateResultJobSettings(array $json): JobSettings 'AvailBlanking' => empty($json['availBlanking']) ? null : $this->populateResultAvailBlanking($json['availBlanking']), 'Esam' => empty($json['esam']) ? null : $this->populateResultEsamSettings($json['esam']), 'ExtendedDataServices' => empty($json['extendedDataServices']) ? null : $this->populateResultExtendedDataServices($json['extendedDataServices']), + 'FollowSource' => isset($json['followSource']) ? (int) $json['followSource'] : null, 'Inputs' => !isset($json['inputs']) ? null : $this->populateResult__listOfInput($json['inputs']), 'KantarWatermark' => empty($json['kantarWatermark']) ? null : $this->populateResultKantarWatermarkSettings($json['kantarWatermark']), 'MotionImageInserter' => empty($json['motionImageInserter']) ? null : $this->populateResultMotionImageInserter($json['motionImageInserter']), @@ -2362,6 +2365,22 @@ private function populateResult__listOfAllowedRenditionSize(array $json): array return $items; } + /** + * @return list + */ + private function populateResult__listOfAudioChannelTag(array $json): array + { + $items = []; + foreach ($json as $item) { + $a = isset($item) ? (string) $item : null; + if (null !== $a) { + $items[] = $a; + } + } + + return $items; + } + /** * @return AudioDescription[] */ diff --git a/src/Service/MediaConvert/src/ValueObject/AiffSettings.php b/src/Service/MediaConvert/src/ValueObject/AiffSettings.php index 80c1c64db..9602dce2a 100644 --- a/src/Service/MediaConvert/src/ValueObject/AiffSettings.php +++ b/src/Service/MediaConvert/src/ValueObject/AiffSettings.php @@ -23,7 +23,7 @@ final class AiffSettings private $channels; /** - * Sample rate in hz. + * Sample rate in Hz. * * @var int|null */ diff --git a/src/Service/MediaConvert/src/ValueObject/AudioChannelTaggingSettings.php b/src/Service/MediaConvert/src/ValueObject/AudioChannelTaggingSettings.php index 2462a49f9..5d9e4bc66 100644 --- a/src/Service/MediaConvert/src/ValueObject/AudioChannelTaggingSettings.php +++ b/src/Service/MediaConvert/src/ValueObject/AudioChannelTaggingSettings.php @@ -6,35 +6,48 @@ use AsyncAws\MediaConvert\Enum\AudioChannelTag; /** - * When you mimic a multi-channel audio layout with multiple mono-channel tracks, you can tag each channel layout - * manually. For example, you would tag the tracks that contain your left, right, and center audio with Left (L), Right - * (R), and Center (C), respectively. When you don't specify a value, MediaConvert labels your track as Center (C) by - * default. To use audio layout tagging, your output must be in a QuickTime (.mov) container; your audio codec must be - * AAC, WAV, or AIFF; and you must set up your audio track to have only one channel. + * Specify the QuickTime audio channel layout tags for the audio channels in this audio track. When you don't specify a + * value, MediaConvert labels your track as Center (C) by default. To use Audio layout tagging, your output must be in a + * QuickTime (MOV) container and your audio codec must be AAC, WAV, or AIFF. */ final class AudioChannelTaggingSettings { /** - * You can add a tag for this mono-channel audio track to mimic its placement in a multi-channel layout. For example, if - * this track is the left surround channel, choose Left surround (LS). + * Specify the QuickTime audio channel layout tags for the audio channels in this audio track. Enter channel layout tags + * in the same order as your output's audio channel order. For example, if your output audio track has a left and a + * right channel, enter Left (L) for the first channel and Right (R) for the second. If your output has multiple + * single-channel audio tracks, enter a single channel layout tag for each track. * * @var AudioChannelTag::*|null */ private $channelTag; + /** + * Specify the QuickTime audio channel layout tags for the audio channels in this audio track. Enter channel layout tags + * in the same order as your output's audio channel order. For example, if your output audio track has a left and a + * right channel, enter Left (L) for the first channel and Right (R) for the second. If your output has multiple + * single-channel audio tracks, enter a single channel layout tag for each track. + * + * @var list|null + */ + private $channelTags; + /** * @param array{ * ChannelTag?: null|AudioChannelTag::*, + * ChannelTags?: null|array, * } $input */ public function __construct(array $input) { $this->channelTag = $input['ChannelTag'] ?? null; + $this->channelTags = $input['ChannelTags'] ?? null; } /** * @param array{ * ChannelTag?: null|AudioChannelTag::*, + * ChannelTags?: null|array, * }|AudioChannelTaggingSettings $input */ public static function create($input): self @@ -50,6 +63,14 @@ public function getChannelTag(): ?string return $this->channelTag; } + /** + * @return list + */ + public function getChannelTags(): array + { + return $this->channelTags ?? []; + } + /** * @internal */ @@ -62,6 +83,17 @@ public function requestBody(): array } $payload['channelTag'] = $v; } + if (null !== $v = $this->channelTags) { + $index = -1; + $payload['channelTags'] = []; + foreach ($v as $listValue) { + ++$index; + if (!AudioChannelTag::exists($listValue)) { + throw new InvalidArgument(sprintf('Invalid parameter "channelTags" for "%s". The value "%s" is not a valid "AudioChannelTag".', __CLASS__, $listValue)); + } + $payload['channelTags'][$index] = $listValue; + } + } return $payload; } diff --git a/src/Service/MediaConvert/src/ValueObject/AudioDescription.php b/src/Service/MediaConvert/src/ValueObject/AudioDescription.php index 926bbd0a9..c1f9ce914 100644 --- a/src/Service/MediaConvert/src/ValueObject/AudioDescription.php +++ b/src/Service/MediaConvert/src/ValueObject/AudioDescription.php @@ -16,11 +16,9 @@ final class AudioDescription { /** - * When you mimic a multi-channel audio layout with multiple mono-channel tracks, you can tag each channel layout - * manually. For example, you would tag the tracks that contain your left, right, and center audio with Left (L), Right - * (R), and Center (C), respectively. When you don't specify a value, MediaConvert labels your track as Center (C) by - * default. To use audio layout tagging, your output must be in a QuickTime (.mov) container; your audio codec must be - * AAC, WAV, or AIFF; and you must set up your audio track to have only one channel. + * Specify the QuickTime audio channel layout tags for the audio channels in this audio track. When you don't specify a + * value, MediaConvert labels your track as Center (C) by default. To use Audio layout tagging, your output must be in a + * QuickTime (MOV) container and your audio codec must be AAC, WAV, or AIFF. * * @var AudioChannelTaggingSettings|null */ diff --git a/src/Service/MediaConvert/src/ValueObject/F4vSettings.php b/src/Service/MediaConvert/src/ValueObject/F4vSettings.php index 13bb584b6..7aca7fe5c 100644 --- a/src/Service/MediaConvert/src/ValueObject/F4vSettings.php +++ b/src/Service/MediaConvert/src/ValueObject/F4vSettings.php @@ -11,8 +11,8 @@ final class F4vSettings { /** - * If set to PROGRESSIVE_DOWNLOAD, the MOOV atom is relocated to the beginning of the archive as required for - * progressive downloading. Otherwise it is placed normally at the end. + * To place the MOOV atom at the beginning of your output, which is useful for progressive downloading: Leave blank or + * choose Progressive download. To place the MOOV at the end of your output: Choose Normal. * * @var F4vMoovPlacement::*|null */ diff --git a/src/Service/MediaConvert/src/ValueObject/FlacSettings.php b/src/Service/MediaConvert/src/ValueObject/FlacSettings.php index 1b0758559..f8ff84f47 100644 --- a/src/Service/MediaConvert/src/ValueObject/FlacSettings.php +++ b/src/Service/MediaConvert/src/ValueObject/FlacSettings.php @@ -23,7 +23,7 @@ final class FlacSettings private $channels; /** - * Sample rate in hz. + * Sample rate in Hz. * * @var int|null */ diff --git a/src/Service/MediaConvert/src/ValueObject/JobSettings.php b/src/Service/MediaConvert/src/ValueObject/JobSettings.php index 2c9c215ca..7193ce6c9 100644 --- a/src/Service/MediaConvert/src/ValueObject/JobSettings.php +++ b/src/Service/MediaConvert/src/ValueObject/JobSettings.php @@ -38,6 +38,17 @@ final class JobSettings */ private $extendedDataServices; + /** + * Specify the input that MediaConvert references for your default output settings. MediaConvert uses this input's + * Resolution, Frame rate, and Pixel aspect ratio for all outputs that you don't manually specify different output + * settings for. Enabling this setting will disable "Follow source" for all other inputs. If MediaConvert cannot follow + * your source, for example if you specify an audio-only input, MediaConvert uses the first followable input instead. In + * your JSON job specification, enter an integer from 1 to 150 corresponding to the order of your inputs. + * + * @var int|null + */ + private $followSource; + /** * Use Inputs to define source file used in the transcode job. There can be multiple inputs add in a job. These inputs * will be concantenated together to create the output. @@ -118,6 +129,7 @@ final class JobSettings * AvailBlanking?: null|AvailBlanking|array, * Esam?: null|EsamSettings|array, * ExtendedDataServices?: null|ExtendedDataServices|array, + * FollowSource?: null|int, * Inputs?: null|array, * KantarWatermark?: null|KantarWatermarkSettings|array, * MotionImageInserter?: null|MotionImageInserter|array, @@ -134,6 +146,7 @@ public function __construct(array $input) $this->availBlanking = isset($input['AvailBlanking']) ? AvailBlanking::create($input['AvailBlanking']) : null; $this->esam = isset($input['Esam']) ? EsamSettings::create($input['Esam']) : null; $this->extendedDataServices = isset($input['ExtendedDataServices']) ? ExtendedDataServices::create($input['ExtendedDataServices']) : null; + $this->followSource = $input['FollowSource'] ?? null; $this->inputs = isset($input['Inputs']) ? array_map([Input::class, 'create'], $input['Inputs']) : null; $this->kantarWatermark = isset($input['KantarWatermark']) ? KantarWatermarkSettings::create($input['KantarWatermark']) : null; $this->motionImageInserter = isset($input['MotionImageInserter']) ? MotionImageInserter::create($input['MotionImageInserter']) : null; @@ -150,6 +163,7 @@ public function __construct(array $input) * AvailBlanking?: null|AvailBlanking|array, * Esam?: null|EsamSettings|array, * ExtendedDataServices?: null|ExtendedDataServices|array, + * FollowSource?: null|int, * Inputs?: null|array, * KantarWatermark?: null|KantarWatermarkSettings|array, * MotionImageInserter?: null|MotionImageInserter|array, @@ -185,6 +199,11 @@ public function getExtendedDataServices(): ?ExtendedDataServices return $this->extendedDataServices; } + public function getFollowSource(): ?int + { + return $this->followSource; + } + /** * @return Input[] */ @@ -249,6 +268,9 @@ public function requestBody(): array if (null !== $v = $this->extendedDataServices) { $payload['extendedDataServices'] = $v->requestBody(); } + if (null !== $v = $this->followSource) { + $payload['followSource'] = $v; + } if (null !== $v = $this->inputs) { $index = -1; $payload['inputs'] = []; diff --git a/src/Service/MediaConvert/src/ValueObject/Mp2Settings.php b/src/Service/MediaConvert/src/ValueObject/Mp2Settings.php index 2dcfa66db..39892ace1 100644 --- a/src/Service/MediaConvert/src/ValueObject/Mp2Settings.php +++ b/src/Service/MediaConvert/src/ValueObject/Mp2Settings.php @@ -23,7 +23,7 @@ final class Mp2Settings private $channels; /** - * Sample rate in hz. + * Sample rate in Hz. * * @var int|null */ diff --git a/src/Service/MediaConvert/src/ValueObject/Mp3Settings.php b/src/Service/MediaConvert/src/ValueObject/Mp3Settings.php index 33c7f14a1..230aecfcf 100644 --- a/src/Service/MediaConvert/src/ValueObject/Mp3Settings.php +++ b/src/Service/MediaConvert/src/ValueObject/Mp3Settings.php @@ -33,7 +33,7 @@ final class Mp3Settings private $rateControlMode; /** - * Sample rate in hz. + * Sample rate in Hz. * * @var int|null */ diff --git a/src/Service/MediaConvert/src/ValueObject/Mp4Settings.php b/src/Service/MediaConvert/src/ValueObject/Mp4Settings.php index d50ff84f3..40320222b 100644 --- a/src/Service/MediaConvert/src/ValueObject/Mp4Settings.php +++ b/src/Service/MediaConvert/src/ValueObject/Mp4Settings.php @@ -57,8 +57,8 @@ final class Mp4Settings private $freeSpaceBox; /** - * If set to PROGRESSIVE_DOWNLOAD, the MOOV atom is relocated to the beginning of the archive as required for - * progressive downloading. Otherwise it is placed normally at the end. + * To place the MOOV atom at the beginning of your output, which is useful for progressive downloading: Leave blank or + * choose Progressive download. To place the MOOV at the end of your output: Choose Normal. * * @var Mp4MoovPlacement::*|null */ diff --git a/src/Service/MediaConvert/src/ValueObject/OpusSettings.php b/src/Service/MediaConvert/src/ValueObject/OpusSettings.php index 7c825ec92..cd635143d 100644 --- a/src/Service/MediaConvert/src/ValueObject/OpusSettings.php +++ b/src/Service/MediaConvert/src/ValueObject/OpusSettings.php @@ -24,7 +24,7 @@ final class OpusSettings private $channels; /** - * Optional. Sample rate in hz. Valid values are 16000, 24000, and 48000. The default value is 48000. + * Optional. Sample rate in Hz. Valid values are 16000, 24000, and 48000. The default value is 48000. * * @var int|null */ diff --git a/src/Service/MediaConvert/src/ValueObject/VideoDescription.php b/src/Service/MediaConvert/src/ValueObject/VideoDescription.php index 62c61d8cc..dc1957688 100644 --- a/src/Service/MediaConvert/src/ValueObject/VideoDescription.php +++ b/src/Service/MediaConvert/src/ValueObject/VideoDescription.php @@ -107,10 +107,8 @@ final class VideoDescription private $respondToAfd; /** - * Specify how the service handles outputs that have a different aspect ratio from the input aspect ratio. Choose - * Stretch to output to have the service stretch your video image to fit. Keep the setting Default to have the service - * letterbox your video instead. This setting overrides any value that you specify for the setting Selection placement - * in this output. + * Specify the video Scaling behavior when your output has a different resolution than your input. For more information, + * see https://docs.aws.amazon.com/mediaconvert/latest/ug/video-scaling.html. * * @var ScalingBehavior::*|null */ diff --git a/src/Service/MediaConvert/src/ValueObject/VideoOverlay.php b/src/Service/MediaConvert/src/ValueObject/VideoOverlay.php index e47abc67e..34f790056 100644 --- a/src/Service/MediaConvert/src/ValueObject/VideoOverlay.php +++ b/src/Service/MediaConvert/src/ValueObject/VideoOverlay.php @@ -3,7 +3,8 @@ namespace AsyncAws\MediaConvert\ValueObject; /** - * Overlay one or more videos on top of your input video. + * Overlay one or more videos on top of your input video. For more information, see + * https://docs.aws.amazon.com/mediaconvert/latest/ug/video-overlays.html. */ final class VideoOverlay { diff --git a/src/Service/MediaConvert/src/ValueObject/VideoOverlayInput.php b/src/Service/MediaConvert/src/ValueObject/VideoOverlayInput.php index 83db68720..01f466a79 100644 --- a/src/Service/MediaConvert/src/ValueObject/VideoOverlayInput.php +++ b/src/Service/MediaConvert/src/ValueObject/VideoOverlayInput.php @@ -28,10 +28,10 @@ final class VideoOverlayInput private $inputClippings; /** - * Specify the starting timecode for your video overlay. To use the timecode present in your video overlay: Choose - * Embedded. To use a zerobased timecode: Choose Start at 0. To choose a timecode: Choose Specified start. When you do, - * enter the starting timecode in Start timecode. If you don't specify a value for Timecode source, MediaConvert uses - * Embedded by default. + * Specify the timecode source for your video overlay input clips. To use the timecode present in your video overlay: + * Choose Embedded. To use a zerobased timecode: Choose Start at 0. To choose a timecode: Choose Specified start. When + * you do, enter the starting timecode in Start timecode. If you don't specify a value for Timecode source, MediaConvert + * uses Embedded by default. * * @var InputTimecodeSource::*|null */ diff --git a/src/Service/S3/src/Input/CompleteMultipartUploadRequest.php b/src/Service/S3/src/Input/CompleteMultipartUploadRequest.php index a1216d80e..a1cbf5376 100644 --- a/src/Service/S3/src/Input/CompleteMultipartUploadRequest.php +++ b/src/Service/S3/src/Input/CompleteMultipartUploadRequest.php @@ -117,11 +117,11 @@ final class CompleteMultipartUploadRequest extends Input private $expectedBucketOwner; /** - * The server-side encryption (SSE) algorithm used to encrypt the object. This parameter is needed only when the object - * was created using a checksum algorithm. For more information, see Protecting data using SSE-C keys [^1] in the - * *Amazon S3 User Guide*. + * The server-side encryption (SSE) algorithm used to encrypt the object. This parameter is required only when the + * object was created using a checksum algorithm or if your bucket policy requires the use of SSE-C. For more + * information, see Protecting data using SSE-C keys [^1] in the *Amazon S3 User Guide*. * - * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html + * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerSideEncryptionCustomerKeys.html#ssec-require-condition-key * * @var string|null */ diff --git a/src/Service/S3/src/Input/CopyObjectRequest.php b/src/Service/S3/src/Input/CopyObjectRequest.php index a38b4e328..144723125 100644 --- a/src/Service/S3/src/Input/CopyObjectRequest.php +++ b/src/Service/S3/src/Input/CopyObjectRequest.php @@ -303,7 +303,8 @@ final class CopyObjectRequest extends Input /** * Specifies the Amazon Web Services KMS Encryption Context to use for object encryption. The value of this header is a - * base64-encoded UTF-8 string holding JSON with the encryption context key-value pairs. + * base64-encoded UTF-8 string holding JSON with the encryption context key-value pairs. This value must be explicitly + * added to specify encryption context for CopyObject requests. * * @var string|null */ diff --git a/src/Service/S3/src/Input/PutObjectRequest.php b/src/Service/S3/src/Input/PutObjectRequest.php index b06fbc213..5e5bbd891 100644 --- a/src/Service/S3/src/Input/PutObjectRequest.php +++ b/src/Service/S3/src/Input/PutObjectRequest.php @@ -331,7 +331,7 @@ final class PutObjectRequest extends Input * Specifies the Amazon Web Services KMS Encryption Context to use for object encryption. The value of this header is a * base64-encoded UTF-8 string holding JSON with the encryption context key-value pairs. This value is stored as object * metadata and automatically gets passed on to Amazon Web Services KMS for future `GetObject` or `CopyObject` - * operations on this object. + * operations on this object. This value must be explicitly added during CopyObject operations. * * @var string|null */ diff --git a/src/Service/S3/src/Result/GetObjectOutput.php b/src/Service/S3/src/Result/GetObjectOutput.php index f4251efc3..149b5098c 100644 --- a/src/Service/S3/src/Result/GetObjectOutput.php +++ b/src/Service/S3/src/Result/GetObjectOutput.php @@ -53,7 +53,7 @@ class GetObjectOutput extends Result private $restore; /** - * Creation date of the object. + * Date and time when the object was last modified. * * @var \DateTimeImmutable|null */ diff --git a/src/Service/S3/src/Result/HeadObjectOutput.php b/src/Service/S3/src/Result/HeadObjectOutput.php index 7e2f78f56..c68639316 100644 --- a/src/Service/S3/src/Result/HeadObjectOutput.php +++ b/src/Service/S3/src/Result/HeadObjectOutput.php @@ -66,7 +66,7 @@ class HeadObjectOutput extends Result private $archiveStatus; /** - * Creation date of the object. + * Date and time when the object was last modified. * * @var \DateTimeImmutable|null */ diff --git a/src/Service/S3/src/S3Client.php b/src/Service/S3/src/S3Client.php index 0fd24f69f..96de09aab 100644 --- a/src/Service/S3/src/S3Client.php +++ b/src/Service/S3/src/S3Client.php @@ -1207,6 +1207,8 @@ public function getBucketEncryption($input): GetBucketEncryptionOutput * > `s3:GetObjectVersion` permission won't be required. * > - If the current version of the object is a delete marker, Amazon S3 behaves as if the object was deleted and * > includes `x-amz-delete-marker: true` in the response. + * > - If the specified version is a delete marker, the response returns a 405 (Method Not Allowed) error and the + * > `Last-Modified: timestamp` response header. * > * * For more information about versioning, see PutBucketVersioning [^8]. @@ -1407,8 +1409,8 @@ public function getObjectTagging($input): GetObjectTaggingOutput * * A `HEAD` request has the same options as a `GET` action on an object. The response is identical to the `GET` response * except that there is no response body. Because of this, if the `HEAD` request generates an error, it returns a - * generic `400 Bad Request`, `403 Forbidden` or `404 Not Found` code. It is not possible to retrieve the exact - * exception beyond these error codes. + * generic code, such as `400 Bad Request`, `403 Forbidden`, `404 Not Found`, `405 Method Not Allowed`, `412 + * Precondition Failed`, or `304 Not Modified`. It's not possible to retrieve the exact exception of these error codes. * * If you encrypt an object by using server-side encryption with customer-provided encryption keys (SSE-C) when you * store the object in Amazon S3, then when you retrieve the metadata from the object, you must use the following @@ -1458,6 +1460,13 @@ public function getObjectTagging($input): GetObjectTaggingOutput * - If you have the `s3:ListBucket` permission on the bucket, Amazon S3 returns an HTTP status code 404 error. * - If you don’t have the `s3:ListBucket` permission, Amazon S3 returns an HTTP status code 403 error. * + * - `Versioning`: + * + * - If the current version of the object is a delete marker, Amazon S3 behaves as if the object was deleted and + * includes `x-amz-delete-marker: true` in the response. + * - If the specified version is a delete marker, the response returns a 405 (Method Not Allowed) error and the + * `Last-Modified: timestamp` response header. + * * * The following actions are related to `HeadObject`: * diff --git a/src/Service/Sqs/CHANGELOG.md b/src/Service/Sqs/CHANGELOG.md index 98e25933c..eb8d14b78 100644 --- a/src/Service/Sqs/CHANGELOG.md +++ b/src/Service/Sqs/CHANGELOG.md @@ -2,6 +2,11 @@ ## NOT RELEASED +### Added + +- AWS api-change: This release enables customers to call SQS using AWS JSON-1.0 protocol and bug fix. +- AWS api-change: This release enables customers to call SQS using AWS JSON-1.0 protocol. + ### Changed - Allow passing explicit null values for optional fields of input objects diff --git a/src/Service/Sqs/composer.json b/src/Service/Sqs/composer.json index 4f9380c89..d0c356f27 100644 --- a/src/Service/Sqs/composer.json +++ b/src/Service/Sqs/composer.json @@ -12,8 +12,8 @@ ], "require": { "php": "^7.2.5 || ^8.0", - "ext-SimpleXML": "*", "ext-filter": "*", + "ext-json": "*", "async-aws/core": "^1.9" }, "autoload": { diff --git a/src/Service/Sqs/src/Exception/InvalidAddressException.php b/src/Service/Sqs/src/Exception/InvalidAddressException.php new file mode 100644 index 000000000..27967818d --- /dev/null +++ b/src/Service/Sqs/src/Exception/InvalidAddressException.php @@ -0,0 +1,12 @@ + 'application/x-www-form-urlencoded']; + $headers = [ + 'Content-Type' => 'application/x-amz-json-1.0', + 'X-Amz-Target' => 'AmazonSQS.ChangeMessageVisibilityBatch', + ]; // Prepare query $query = []; @@ -84,7 +87,8 @@ public function request(): Request $uriString = '/'; // Prepare Body - $body = http_build_query(['Action' => 'ChangeMessageVisibilityBatch', 'Version' => '2012-11-05'] + $this->requestBody(), '', '&', \PHP_QUERY_RFC1738); + $bodyPayload = $this->requestBody(); + $body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload, 4194304); // Return the Request return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body)); @@ -118,12 +122,11 @@ private function requestBody(): array throw new InvalidArgument(sprintf('Missing parameter "Entries" for "%s". The value cannot be null.', __CLASS__)); } - $index = 0; - foreach ($v as $mapValue) { + $index = -1; + $payload['Entries'] = []; + foreach ($v as $listValue) { ++$index; - foreach ($mapValue->requestBody() as $bodyKey => $bodyValue) { - $payload["ChangeMessageVisibilityBatchRequestEntry.$index.$bodyKey"] = $bodyValue; - } + $payload['Entries'][$index] = $listValue->requestBody(); } return $payload; diff --git a/src/Service/Sqs/src/Input/ChangeMessageVisibilityRequest.php b/src/Service/Sqs/src/Input/ChangeMessageVisibilityRequest.php index 423b9a7d0..07b14bace 100644 --- a/src/Service/Sqs/src/Input/ChangeMessageVisibilityRequest.php +++ b/src/Service/Sqs/src/Input/ChangeMessageVisibilityRequest.php @@ -89,7 +89,10 @@ public function getVisibilityTimeout(): ?int public function request(): Request { // Prepare headers - $headers = ['content-type' => 'application/x-www-form-urlencoded']; + $headers = [ + 'Content-Type' => 'application/x-amz-json-1.0', + 'X-Amz-Target' => 'AmazonSQS.ChangeMessageVisibility', + ]; // Prepare query $query = []; @@ -98,7 +101,8 @@ public function request(): Request $uriString = '/'; // Prepare Body - $body = http_build_query(['Action' => 'ChangeMessageVisibility', 'Version' => '2012-11-05'] + $this->requestBody(), '', '&', \PHP_QUERY_RFC1738); + $bodyPayload = $this->requestBody(); + $body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload, 4194304); // Return the Request return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body)); diff --git a/src/Service/Sqs/src/Input/CreateQueueRequest.php b/src/Service/Sqs/src/Input/CreateQueueRequest.php index ba1c3052f..7f4958ed3 100644 --- a/src/Service/Sqs/src/Input/CreateQueueRequest.php +++ b/src/Service/Sqs/src/Input/CreateQueueRequest.php @@ -244,7 +244,10 @@ public function getTags(): array public function request(): Request { // Prepare headers - $headers = ['content-type' => 'application/x-www-form-urlencoded']; + $headers = [ + 'Content-Type' => 'application/x-amz-json-1.0', + 'X-Amz-Target' => 'AmazonSQS.CreateQueue', + ]; // Prepare query $query = []; @@ -253,7 +256,8 @@ public function request(): Request $uriString = '/'; // Prepare Body - $body = http_build_query(['Action' => 'CreateQueue', 'Version' => '2012-11-05'] + $this->requestBody(), '', '&', \PHP_QUERY_RFC1738); + $bodyPayload = $this->requestBody(); + $body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload, 4194304); // Return the Request return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body)); @@ -294,22 +298,26 @@ private function requestBody(): array } $payload['QueueName'] = $v; if (null !== $v = $this->attributes) { - $index = 0; - foreach ($v as $mapKey => $mapValue) { - if (!QueueAttributeName::exists($mapKey)) { - throw new InvalidArgument(sprintf('Invalid key for "%s". The value "%s" is not a valid "QueueAttributeName".', __CLASS__, $mapKey)); + if (empty($v)) { + $payload['Attributes'] = new \stdClass(); + } else { + $payload['Attributes'] = []; + foreach ($v as $name => $mv) { + if (!QueueAttributeName::exists($name)) { + throw new InvalidArgument(sprintf('Invalid key for "%s". The value "%s" is not a valid "QueueAttributeName".', __CLASS__, $name)); + } + $payload['Attributes'][$name] = $mv; } - ++$index; - $payload["Attribute.$index.Name"] = $mapKey; - $payload["Attribute.$index.Value"] = $mapValue; } } if (null !== $v = $this->tags) { - $index = 0; - foreach ($v as $mapKey => $mapValue) { - ++$index; - $payload["Tag.$index.Key"] = $mapKey; - $payload["Tag.$index.Value"] = $mapValue; + if (empty($v)) { + $payload['tags'] = new \stdClass(); + } else { + $payload['tags'] = []; + foreach ($v as $name => $mv) { + $payload['tags'][$name] = $mv; + } } } diff --git a/src/Service/Sqs/src/Input/DeleteMessageBatchRequest.php b/src/Service/Sqs/src/Input/DeleteMessageBatchRequest.php index 3ef682b5d..cc7421923 100644 --- a/src/Service/Sqs/src/Input/DeleteMessageBatchRequest.php +++ b/src/Service/Sqs/src/Input/DeleteMessageBatchRequest.php @@ -75,7 +75,10 @@ public function getQueueUrl(): ?string public function request(): Request { // Prepare headers - $headers = ['content-type' => 'application/x-www-form-urlencoded']; + $headers = [ + 'Content-Type' => 'application/x-amz-json-1.0', + 'X-Amz-Target' => 'AmazonSQS.DeleteMessageBatch', + ]; // Prepare query $query = []; @@ -84,7 +87,8 @@ public function request(): Request $uriString = '/'; // Prepare Body - $body = http_build_query(['Action' => 'DeleteMessageBatch', 'Version' => '2012-11-05'] + $this->requestBody(), '', '&', \PHP_QUERY_RFC1738); + $bodyPayload = $this->requestBody(); + $body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload, 4194304); // Return the Request return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body)); @@ -118,12 +122,11 @@ private function requestBody(): array throw new InvalidArgument(sprintf('Missing parameter "Entries" for "%s". The value cannot be null.', __CLASS__)); } - $index = 0; - foreach ($v as $mapValue) { + $index = -1; + $payload['Entries'] = []; + foreach ($v as $listValue) { ++$index; - foreach ($mapValue->requestBody() as $bodyKey => $bodyValue) { - $payload["DeleteMessageBatchRequestEntry.$index.$bodyKey"] = $bodyValue; - } + $payload['Entries'][$index] = $listValue->requestBody(); } return $payload; diff --git a/src/Service/Sqs/src/Input/DeleteMessageRequest.php b/src/Service/Sqs/src/Input/DeleteMessageRequest.php index 1f0b358dd..d9a46a27a 100644 --- a/src/Service/Sqs/src/Input/DeleteMessageRequest.php +++ b/src/Service/Sqs/src/Input/DeleteMessageRequest.php @@ -71,7 +71,10 @@ public function getReceiptHandle(): ?string public function request(): Request { // Prepare headers - $headers = ['content-type' => 'application/x-www-form-urlencoded']; + $headers = [ + 'Content-Type' => 'application/x-amz-json-1.0', + 'X-Amz-Target' => 'AmazonSQS.DeleteMessage', + ]; // Prepare query $query = []; @@ -80,7 +83,8 @@ public function request(): Request $uriString = '/'; // Prepare Body - $body = http_build_query(['Action' => 'DeleteMessage', 'Version' => '2012-11-05'] + $this->requestBody(), '', '&', \PHP_QUERY_RFC1738); + $bodyPayload = $this->requestBody(); + $body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload, 4194304); // Return the Request return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body)); diff --git a/src/Service/Sqs/src/Input/DeleteQueueRequest.php b/src/Service/Sqs/src/Input/DeleteQueueRequest.php index 2fc6b1524..c9c11007b 100644 --- a/src/Service/Sqs/src/Input/DeleteQueueRequest.php +++ b/src/Service/Sqs/src/Input/DeleteQueueRequest.php @@ -54,7 +54,10 @@ public function getQueueUrl(): ?string public function request(): Request { // Prepare headers - $headers = ['content-type' => 'application/x-www-form-urlencoded']; + $headers = [ + 'Content-Type' => 'application/x-amz-json-1.0', + 'X-Amz-Target' => 'AmazonSQS.DeleteQueue', + ]; // Prepare query $query = []; @@ -63,7 +66,8 @@ public function request(): Request $uriString = '/'; // Prepare Body - $body = http_build_query(['Action' => 'DeleteQueue', 'Version' => '2012-11-05'] + $this->requestBody(), '', '&', \PHP_QUERY_RFC1738); + $bodyPayload = $this->requestBody(); + $body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload, 4194304); // Return the Request return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body)); diff --git a/src/Service/Sqs/src/Input/GetQueueAttributesRequest.php b/src/Service/Sqs/src/Input/GetQueueAttributesRequest.php index 7009d5b18..bc3c20b7e 100644 --- a/src/Service/Sqs/src/Input/GetQueueAttributesRequest.php +++ b/src/Service/Sqs/src/Input/GetQueueAttributesRequest.php @@ -198,7 +198,10 @@ public function getQueueUrl(): ?string public function request(): Request { // Prepare headers - $headers = ['content-type' => 'application/x-www-form-urlencoded']; + $headers = [ + 'Content-Type' => 'application/x-amz-json-1.0', + 'X-Amz-Target' => 'AmazonSQS.GetQueueAttributes', + ]; // Prepare query $query = []; @@ -207,7 +210,8 @@ public function request(): Request $uriString = '/'; // Prepare Body - $body = http_build_query(['Action' => 'GetQueueAttributes', 'Version' => '2012-11-05'] + $this->requestBody(), '', '&', \PHP_QUERY_RFC1738); + $bodyPayload = $this->requestBody(); + $body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload, 4194304); // Return the Request return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body)); @@ -238,13 +242,14 @@ private function requestBody(): array } $payload['QueueUrl'] = $v; if (null !== $v = $this->attributeNames) { - $index = 0; - foreach ($v as $mapValue) { + $index = -1; + $payload['AttributeNames'] = []; + foreach ($v as $listValue) { ++$index; - if (!QueueAttributeName::exists($mapValue)) { - throw new InvalidArgument(sprintf('Invalid parameter "AttributeName" for "%s". The value "%s" is not a valid "QueueAttributeName".', __CLASS__, $mapValue)); + if (!QueueAttributeName::exists($listValue)) { + throw new InvalidArgument(sprintf('Invalid parameter "AttributeNames" for "%s". The value "%s" is not a valid "QueueAttributeName".', __CLASS__, $listValue)); } - $payload["AttributeName.$index"] = $mapValue; + $payload['AttributeNames'][$index] = $listValue; } } diff --git a/src/Service/Sqs/src/Input/GetQueueUrlRequest.php b/src/Service/Sqs/src/Input/GetQueueUrlRequest.php index 74160c27e..62bca372a 100644 --- a/src/Service/Sqs/src/Input/GetQueueUrlRequest.php +++ b/src/Service/Sqs/src/Input/GetQueueUrlRequest.php @@ -70,7 +70,10 @@ public function getQueueOwnerAwsAccountId(): ?string public function request(): Request { // Prepare headers - $headers = ['content-type' => 'application/x-www-form-urlencoded']; + $headers = [ + 'Content-Type' => 'application/x-amz-json-1.0', + 'X-Amz-Target' => 'AmazonSQS.GetQueueUrl', + ]; // Prepare query $query = []; @@ -79,7 +82,8 @@ public function request(): Request $uriString = '/'; // Prepare Body - $body = http_build_query(['Action' => 'GetQueueUrl', 'Version' => '2012-11-05'] + $this->requestBody(), '', '&', \PHP_QUERY_RFC1738); + $bodyPayload = $this->requestBody(); + $body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload, 4194304); // Return the Request return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body)); diff --git a/src/Service/Sqs/src/Input/ListQueuesRequest.php b/src/Service/Sqs/src/Input/ListQueuesRequest.php index c27449f05..46cc9fe69 100644 --- a/src/Service/Sqs/src/Input/ListQueuesRequest.php +++ b/src/Service/Sqs/src/Input/ListQueuesRequest.php @@ -83,7 +83,10 @@ public function getQueueNamePrefix(): ?string public function request(): Request { // Prepare headers - $headers = ['content-type' => 'application/x-www-form-urlencoded']; + $headers = [ + 'Content-Type' => 'application/x-amz-json-1.0', + 'X-Amz-Target' => 'AmazonSQS.ListQueues', + ]; // Prepare query $query = []; @@ -92,7 +95,8 @@ public function request(): Request $uriString = '/'; // Prepare Body - $body = http_build_query(['Action' => 'ListQueues', 'Version' => '2012-11-05'] + $this->requestBody(), '', '&', \PHP_QUERY_RFC1738); + $bodyPayload = $this->requestBody(); + $body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload, 4194304); // Return the Request return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body)); diff --git a/src/Service/Sqs/src/Input/PurgeQueueRequest.php b/src/Service/Sqs/src/Input/PurgeQueueRequest.php index 301d41709..c5df1877c 100644 --- a/src/Service/Sqs/src/Input/PurgeQueueRequest.php +++ b/src/Service/Sqs/src/Input/PurgeQueueRequest.php @@ -54,7 +54,10 @@ public function getQueueUrl(): ?string public function request(): Request { // Prepare headers - $headers = ['content-type' => 'application/x-www-form-urlencoded']; + $headers = [ + 'Content-Type' => 'application/x-amz-json-1.0', + 'X-Amz-Target' => 'AmazonSQS.PurgeQueue', + ]; // Prepare query $query = []; @@ -63,7 +66,8 @@ public function request(): Request $uriString = '/'; // Prepare Body - $body = http_build_query(['Action' => 'PurgeQueue', 'Version' => '2012-11-05'] + $this->requestBody(), '', '&', \PHP_QUERY_RFC1738); + $bodyPayload = $this->requestBody(); + $body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload, 4194304); // Return the Request return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body)); diff --git a/src/Service/Sqs/src/Input/ReceiveMessageRequest.php b/src/Service/Sqs/src/Input/ReceiveMessageRequest.php index 814032112..2475fd581 100644 --- a/src/Service/Sqs/src/Input/ReceiveMessageRequest.php +++ b/src/Service/Sqs/src/Input/ReceiveMessageRequest.php @@ -209,7 +209,10 @@ public function getWaitTimeSeconds(): ?int public function request(): Request { // Prepare headers - $headers = ['content-type' => 'application/x-www-form-urlencoded']; + $headers = [ + 'Content-Type' => 'application/x-amz-json-1.0', + 'X-Amz-Target' => 'AmazonSQS.ReceiveMessage', + ]; // Prepare query $query = []; @@ -218,7 +221,8 @@ public function request(): Request $uriString = '/'; // Prepare Body - $body = http_build_query(['Action' => 'ReceiveMessage', 'Version' => '2012-11-05'] + $this->requestBody(), '', '&', \PHP_QUERY_RFC1738); + $bodyPayload = $this->requestBody(); + $body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload, 4194304); // Return the Request return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body)); @@ -287,20 +291,22 @@ private function requestBody(): array } $payload['QueueUrl'] = $v; if (null !== $v = $this->attributeNames) { - $index = 0; - foreach ($v as $mapValue) { + $index = -1; + $payload['AttributeNames'] = []; + foreach ($v as $listValue) { ++$index; - if (!MessageSystemAttributeName::exists($mapValue)) { - throw new InvalidArgument(sprintf('Invalid parameter "AttributeName" for "%s". The value "%s" is not a valid "MessageSystemAttributeName".', __CLASS__, $mapValue)); + if (!MessageSystemAttributeName::exists($listValue)) { + throw new InvalidArgument(sprintf('Invalid parameter "AttributeNames" for "%s". The value "%s" is not a valid "MessageSystemAttributeName".', __CLASS__, $listValue)); } - $payload["AttributeName.$index"] = $mapValue; + $payload['AttributeNames'][$index] = $listValue; } } if (null !== $v = $this->messageAttributeNames) { - $index = 0; - foreach ($v as $mapValue) { + $index = -1; + $payload['MessageAttributeNames'] = []; + foreach ($v as $listValue) { ++$index; - $payload["MessageAttributeName.$index"] = $mapValue; + $payload['MessageAttributeNames'][$index] = $listValue; } } if (null !== $v = $this->maxNumberOfMessages) { diff --git a/src/Service/Sqs/src/Input/SendMessageBatchRequest.php b/src/Service/Sqs/src/Input/SendMessageBatchRequest.php index bf61b6da6..a3a7280fe 100644 --- a/src/Service/Sqs/src/Input/SendMessageBatchRequest.php +++ b/src/Service/Sqs/src/Input/SendMessageBatchRequest.php @@ -75,7 +75,10 @@ public function getQueueUrl(): ?string public function request(): Request { // Prepare headers - $headers = ['content-type' => 'application/x-www-form-urlencoded']; + $headers = [ + 'Content-Type' => 'application/x-amz-json-1.0', + 'X-Amz-Target' => 'AmazonSQS.SendMessageBatch', + ]; // Prepare query $query = []; @@ -84,7 +87,8 @@ public function request(): Request $uriString = '/'; // Prepare Body - $body = http_build_query(['Action' => 'SendMessageBatch', 'Version' => '2012-11-05'] + $this->requestBody(), '', '&', \PHP_QUERY_RFC1738); + $bodyPayload = $this->requestBody(); + $body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload, 4194304); // Return the Request return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body)); @@ -118,12 +122,11 @@ private function requestBody(): array throw new InvalidArgument(sprintf('Missing parameter "Entries" for "%s". The value cannot be null.', __CLASS__)); } - $index = 0; - foreach ($v as $mapValue) { + $index = -1; + $payload['Entries'] = []; + foreach ($v as $listValue) { ++$index; - foreach ($mapValue->requestBody() as $bodyKey => $bodyValue) { - $payload["SendMessageBatchRequestEntry.$index.$bodyKey"] = $bodyValue; - } + $payload['Entries'][$index] = $listValue->requestBody(); } return $payload; diff --git a/src/Service/Sqs/src/Input/SendMessageRequest.php b/src/Service/Sqs/src/Input/SendMessageRequest.php index d35edc1ff..4b9b59c7d 100644 --- a/src/Service/Sqs/src/Input/SendMessageRequest.php +++ b/src/Service/Sqs/src/Input/SendMessageRequest.php @@ -248,7 +248,10 @@ public function getQueueUrl(): ?string public function request(): Request { // Prepare headers - $headers = ['content-type' => 'application/x-www-form-urlencoded']; + $headers = [ + 'Content-Type' => 'application/x-amz-json-1.0', + 'X-Amz-Target' => 'AmazonSQS.SendMessage', + ]; // Prepare query $query = []; @@ -257,7 +260,8 @@ public function request(): Request $uriString = '/'; // Prepare Body - $body = http_build_query(['Action' => 'SendMessage', 'Version' => '2012-11-05'] + $this->requestBody(), '', '&', \PHP_QUERY_RFC1738); + $bodyPayload = $this->requestBody(); + $body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload, 4194304); // Return the Request return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body)); @@ -333,25 +337,25 @@ private function requestBody(): array $payload['DelaySeconds'] = $v; } if (null !== $v = $this->messageAttributes) { - $index = 0; - foreach ($v as $mapKey => $mapValue) { - ++$index; - $payload["MessageAttribute.$index.Name"] = $mapKey; - foreach ($mapValue->requestBody() as $bodyKey => $bodyValue) { - $payload["MessageAttribute.$index.Value.$bodyKey"] = $bodyValue; + if (empty($v)) { + $payload['MessageAttributes'] = new \stdClass(); + } else { + $payload['MessageAttributes'] = []; + foreach ($v as $name => $mv) { + $payload['MessageAttributes'][$name] = $mv->requestBody(); } } } if (null !== $v = $this->messageSystemAttributes) { - $index = 0; - foreach ($v as $mapKey => $mapValue) { - if (!MessageSystemAttributeNameForSends::exists($mapKey)) { - throw new InvalidArgument(sprintf('Invalid key for "%s". The value "%s" is not a valid "MessageSystemAttributeNameForSends".', __CLASS__, $mapKey)); - } - ++$index; - $payload["MessageSystemAttribute.$index.Name"] = $mapKey; - foreach ($mapValue->requestBody() as $bodyKey => $bodyValue) { - $payload["MessageSystemAttribute.$index.Value.$bodyKey"] = $bodyValue; + if (empty($v)) { + $payload['MessageSystemAttributes'] = new \stdClass(); + } else { + $payload['MessageSystemAttributes'] = []; + foreach ($v as $name => $mv) { + if (!MessageSystemAttributeNameForSends::exists($name)) { + throw new InvalidArgument(sprintf('Invalid key for "%s". The value "%s" is not a valid "MessageSystemAttributeNameForSends".', __CLASS__, $name)); + } + $payload['MessageSystemAttributes'][$name] = $mv->requestBody(); } } } diff --git a/src/Service/Sqs/src/Result/ChangeMessageVisibilityBatchResult.php b/src/Service/Sqs/src/Result/ChangeMessageVisibilityBatchResult.php index 7536998d2..05578662c 100644 --- a/src/Service/Sqs/src/Result/ChangeMessageVisibilityBatchResult.php +++ b/src/Service/Sqs/src/Result/ChangeMessageVisibilityBatchResult.php @@ -49,41 +49,50 @@ public function getSuccessful(): array protected function populateResult(Response $response): void { - $data = new \SimpleXMLElement($response->getContent()); - $data = $data->ChangeMessageVisibilityBatchResult; + $data = $response->toArray(); - $this->successful = $this->populateResultChangeMessageVisibilityBatchResultEntryList($data->ChangeMessageVisibilityBatchResultEntry); - $this->failed = $this->populateResultBatchResultErrorEntryList($data->BatchResultErrorEntry); + $this->successful = $this->populateResultChangeMessageVisibilityBatchResultEntryList($data['Successful']); + $this->failed = $this->populateResultBatchResultErrorEntryList($data['Failed']); + } + + private function populateResultBatchResultErrorEntry(array $json): BatchResultErrorEntry + { + return new BatchResultErrorEntry([ + 'Id' => (string) $json['Id'], + 'SenderFault' => filter_var($json['SenderFault'], \FILTER_VALIDATE_BOOLEAN), + 'Code' => (string) $json['Code'], + 'Message' => isset($json['Message']) ? (string) $json['Message'] : null, + ]); } /** * @return BatchResultErrorEntry[] */ - private function populateResultBatchResultErrorEntryList(\SimpleXMLElement $xml): array + private function populateResultBatchResultErrorEntryList(array $json): array { $items = []; - foreach ($xml as $item) { - $items[] = new BatchResultErrorEntry([ - 'Id' => (string) $item->Id, - 'SenderFault' => filter_var((string) $item->SenderFault, \FILTER_VALIDATE_BOOLEAN), - 'Code' => (string) $item->Code, - 'Message' => ($v = $item->Message) ? (string) $v : null, - ]); + foreach ($json as $item) { + $items[] = $this->populateResultBatchResultErrorEntry($item); } return $items; } + private function populateResultChangeMessageVisibilityBatchResultEntry(array $json): ChangeMessageVisibilityBatchResultEntry + { + return new ChangeMessageVisibilityBatchResultEntry([ + 'Id' => (string) $json['Id'], + ]); + } + /** * @return ChangeMessageVisibilityBatchResultEntry[] */ - private function populateResultChangeMessageVisibilityBatchResultEntryList(\SimpleXMLElement $xml): array + private function populateResultChangeMessageVisibilityBatchResultEntryList(array $json): array { $items = []; - foreach ($xml as $item) { - $items[] = new ChangeMessageVisibilityBatchResultEntry([ - 'Id' => (string) $item->Id, - ]); + foreach ($json as $item) { + $items[] = $this->populateResultChangeMessageVisibilityBatchResultEntry($item); } return $items; diff --git a/src/Service/Sqs/src/Result/CreateQueueResult.php b/src/Service/Sqs/src/Result/CreateQueueResult.php index d29e5571d..006823c05 100644 --- a/src/Service/Sqs/src/Result/CreateQueueResult.php +++ b/src/Service/Sqs/src/Result/CreateQueueResult.php @@ -26,9 +26,8 @@ public function getQueueUrl(): ?string protected function populateResult(Response $response): void { - $data = new \SimpleXMLElement($response->getContent()); - $data = $data->CreateQueueResult; + $data = $response->toArray(); - $this->queueUrl = ($v = $data->QueueUrl) ? (string) $v : null; + $this->queueUrl = isset($data['QueueUrl']) ? (string) $data['QueueUrl'] : null; } } diff --git a/src/Service/Sqs/src/Result/DeleteMessageBatchResult.php b/src/Service/Sqs/src/Result/DeleteMessageBatchResult.php index c447a9db6..c4f07c201 100644 --- a/src/Service/Sqs/src/Result/DeleteMessageBatchResult.php +++ b/src/Service/Sqs/src/Result/DeleteMessageBatchResult.php @@ -49,41 +49,50 @@ public function getSuccessful(): array protected function populateResult(Response $response): void { - $data = new \SimpleXMLElement($response->getContent()); - $data = $data->DeleteMessageBatchResult; + $data = $response->toArray(); - $this->successful = $this->populateResultDeleteMessageBatchResultEntryList($data->DeleteMessageBatchResultEntry); - $this->failed = $this->populateResultBatchResultErrorEntryList($data->BatchResultErrorEntry); + $this->successful = $this->populateResultDeleteMessageBatchResultEntryList($data['Successful']); + $this->failed = $this->populateResultBatchResultErrorEntryList($data['Failed']); + } + + private function populateResultBatchResultErrorEntry(array $json): BatchResultErrorEntry + { + return new BatchResultErrorEntry([ + 'Id' => (string) $json['Id'], + 'SenderFault' => filter_var($json['SenderFault'], \FILTER_VALIDATE_BOOLEAN), + 'Code' => (string) $json['Code'], + 'Message' => isset($json['Message']) ? (string) $json['Message'] : null, + ]); } /** * @return BatchResultErrorEntry[] */ - private function populateResultBatchResultErrorEntryList(\SimpleXMLElement $xml): array + private function populateResultBatchResultErrorEntryList(array $json): array { $items = []; - foreach ($xml as $item) { - $items[] = new BatchResultErrorEntry([ - 'Id' => (string) $item->Id, - 'SenderFault' => filter_var((string) $item->SenderFault, \FILTER_VALIDATE_BOOLEAN), - 'Code' => (string) $item->Code, - 'Message' => ($v = $item->Message) ? (string) $v : null, - ]); + foreach ($json as $item) { + $items[] = $this->populateResultBatchResultErrorEntry($item); } return $items; } + private function populateResultDeleteMessageBatchResultEntry(array $json): DeleteMessageBatchResultEntry + { + return new DeleteMessageBatchResultEntry([ + 'Id' => (string) $json['Id'], + ]); + } + /** * @return DeleteMessageBatchResultEntry[] */ - private function populateResultDeleteMessageBatchResultEntryList(\SimpleXMLElement $xml): array + private function populateResultDeleteMessageBatchResultEntryList(array $json): array { $items = []; - foreach ($xml as $item) { - $items[] = new DeleteMessageBatchResultEntry([ - 'Id' => (string) $item->Id, - ]); + foreach ($json as $item) { + $items[] = $this->populateResultDeleteMessageBatchResultEntry($item); } return $items; diff --git a/src/Service/Sqs/src/Result/GetQueueAttributesResult.php b/src/Service/Sqs/src/Result/GetQueueAttributesResult.php index 60c690ef6..d2b84897e 100644 --- a/src/Service/Sqs/src/Result/GetQueueAttributesResult.php +++ b/src/Service/Sqs/src/Result/GetQueueAttributesResult.php @@ -30,21 +30,19 @@ public function getAttributes(): array protected function populateResult(Response $response): void { - $data = new \SimpleXMLElement($response->getContent()); - $data = $data->GetQueueAttributesResult; + $data = $response->toArray(); - $this->attributes = !$data->Attribute ? [] : $this->populateResultQueueAttributeMap($data->Attribute); + $this->attributes = empty($data['Attributes']) ? [] : $this->populateResultQueueAttributeMap($data['Attributes']); } /** * @return array */ - private function populateResultQueueAttributeMap(\SimpleXMLElement $xml): array + private function populateResultQueueAttributeMap(array $json): array { $items = []; - foreach ($xml as $item) { - $a = $item->Value; - $items[$item->Name->__toString()] = (string) $a; + foreach ($json as $name => $value) { + $items[(string) $name] = (string) $value; } return $items; diff --git a/src/Service/Sqs/src/Result/GetQueueUrlResult.php b/src/Service/Sqs/src/Result/GetQueueUrlResult.php index c500d0c78..a15cfd099 100644 --- a/src/Service/Sqs/src/Result/GetQueueUrlResult.php +++ b/src/Service/Sqs/src/Result/GetQueueUrlResult.php @@ -28,9 +28,8 @@ public function getQueueUrl(): ?string protected function populateResult(Response $response): void { - $data = new \SimpleXMLElement($response->getContent()); - $data = $data->GetQueueUrlResult; + $data = $response->toArray(); - $this->queueUrl = ($v = $data->QueueUrl) ? (string) $v : null; + $this->queueUrl = isset($data['QueueUrl']) ? (string) $data['QueueUrl'] : null; } } diff --git a/src/Service/Sqs/src/Result/ListQueuesResult.php b/src/Service/Sqs/src/Result/ListQueuesResult.php index 3ade0cc39..7ad3b5f61 100644 --- a/src/Service/Sqs/src/Result/ListQueuesResult.php +++ b/src/Service/Sqs/src/Result/ListQueuesResult.php @@ -93,21 +93,20 @@ public function getQueueUrls(bool $currentPageOnly = false): iterable protected function populateResult(Response $response): void { - $data = new \SimpleXMLElement($response->getContent()); - $data = $data->ListQueuesResult; + $data = $response->toArray(); - $this->queueUrls = !$data->QueueUrl ? [] : $this->populateResultQueueUrlList($data->QueueUrl); - $this->nextToken = ($v = $data->NextToken) ? (string) $v : null; + $this->queueUrls = empty($data['QueueUrls']) ? [] : $this->populateResultQueueUrlList($data['QueueUrls']); + $this->nextToken = isset($data['NextToken']) ? (string) $data['NextToken'] : null; } /** * @return string[] */ - private function populateResultQueueUrlList(\SimpleXMLElement $xml): array + private function populateResultQueueUrlList(array $json): array { $items = []; - foreach ($xml as $item) { - $a = ($v = $item) ? (string) $v : null; + foreach ($json as $item) { + $a = isset($item) ? (string) $item : null; if (null !== $a) { $items[] = $a; } diff --git a/src/Service/Sqs/src/Result/QueueExistsWaiter.php b/src/Service/Sqs/src/Result/QueueExistsWaiter.php index c971453d2..38ac2672d 100644 --- a/src/Service/Sqs/src/Result/QueueExistsWaiter.php +++ b/src/Service/Sqs/src/Result/QueueExistsWaiter.php @@ -20,7 +20,7 @@ protected function extractState(Response $response, ?HttpException $exception): return self::STATE_SUCCESS; } - if (null !== $exception && 'AWS.SimpleQueueService.NonExistentQueue' === $exception->getAwsCode() && 400 === $exception->getCode()) { + if (null !== $exception && 'QueueDoesNotExist' === $exception->getAwsCode()) { return self::STATE_PENDING; } diff --git a/src/Service/Sqs/src/Result/ReceiveMessageResult.php b/src/Service/Sqs/src/Result/ReceiveMessageResult.php index 8896f38ff..f5ab4c9ab 100644 --- a/src/Service/Sqs/src/Result/ReceiveMessageResult.php +++ b/src/Service/Sqs/src/Result/ReceiveMessageResult.php @@ -32,20 +32,19 @@ public function getMessages(): array protected function populateResult(Response $response): void { - $data = new \SimpleXMLElement($response->getContent()); - $data = $data->ReceiveMessageResult; + $data = $response->toArray(); - $this->messages = !$data->Message ? [] : $this->populateResultMessageList($data->Message); + $this->messages = empty($data['Messages']) ? [] : $this->populateResultMessageList($data['Messages']); } /** * @return string[] */ - private function populateResultBinaryList(\SimpleXMLElement $xml): array + private function populateResultBinaryList(array $json): array { $items = []; - foreach ($xml->BinaryListValue as $item) { - $a = ($v = $item) ? base64_decode((string) $v) : null; + foreach ($json as $item) { + $a = isset($item) ? base64_decode((string) $item) : null; if (null !== $a) { $items[] = $a; } @@ -54,21 +53,38 @@ private function populateResultBinaryList(\SimpleXMLElement $xml): array return $items; } + private function populateResultMessage(array $json): Message + { + return new Message([ + 'MessageId' => isset($json['MessageId']) ? (string) $json['MessageId'] : null, + 'ReceiptHandle' => isset($json['ReceiptHandle']) ? (string) $json['ReceiptHandle'] : null, + 'MD5OfBody' => isset($json['MD5OfBody']) ? (string) $json['MD5OfBody'] : null, + 'Body' => isset($json['Body']) ? (string) $json['Body'] : null, + 'Attributes' => !isset($json['Attributes']) ? null : $this->populateResultMessageSystemAttributeMap($json['Attributes']), + 'MD5OfMessageAttributes' => isset($json['MD5OfMessageAttributes']) ? (string) $json['MD5OfMessageAttributes'] : null, + 'MessageAttributes' => !isset($json['MessageAttributes']) ? null : $this->populateResultMessageBodyAttributeMap($json['MessageAttributes']), + ]); + } + + private function populateResultMessageAttributeValue(array $json): MessageAttributeValue + { + return new MessageAttributeValue([ + 'StringValue' => isset($json['StringValue']) ? (string) $json['StringValue'] : null, + 'BinaryValue' => isset($json['BinaryValue']) ? base64_decode((string) $json['BinaryValue']) : null, + 'StringListValues' => !isset($json['StringListValues']) ? null : $this->populateResultStringList($json['StringListValues']), + 'BinaryListValues' => !isset($json['BinaryListValues']) ? null : $this->populateResultBinaryList($json['BinaryListValues']), + 'DataType' => (string) $json['DataType'], + ]); + } + /** * @return array */ - private function populateResultMessageBodyAttributeMap(\SimpleXMLElement $xml): array + private function populateResultMessageBodyAttributeMap(array $json): array { $items = []; - foreach ($xml as $item) { - $a = $item->Value; - $items[$item->Name->__toString()] = new MessageAttributeValue([ - 'StringValue' => ($v = $a->StringValue) ? (string) $v : null, - 'BinaryValue' => ($v = $a->BinaryValue) ? base64_decode((string) $v) : null, - 'StringListValues' => !$a->StringListValue ? null : $this->populateResultStringList($a->StringListValue), - 'BinaryListValues' => !$a->BinaryListValue ? null : $this->populateResultBinaryList($a->BinaryListValue), - 'DataType' => (string) $a->DataType, - ]); + foreach ($json as $name => $value) { + $items[(string) $name] = $this->populateResultMessageAttributeValue($value); } return $items; @@ -77,19 +93,11 @@ private function populateResultMessageBodyAttributeMap(\SimpleXMLElement $xml): /** * @return Message[] */ - private function populateResultMessageList(\SimpleXMLElement $xml): array + private function populateResultMessageList(array $json): array { $items = []; - foreach ($xml as $item) { - $items[] = new Message([ - 'MessageId' => ($v = $item->MessageId) ? (string) $v : null, - 'ReceiptHandle' => ($v = $item->ReceiptHandle) ? (string) $v : null, - 'MD5OfBody' => ($v = $item->MD5OfBody) ? (string) $v : null, - 'Body' => ($v = $item->Body) ? (string) $v : null, - 'Attributes' => !$item->Attribute ? null : $this->populateResultMessageSystemAttributeMap($item->Attribute), - 'MD5OfMessageAttributes' => ($v = $item->MD5OfMessageAttributes) ? (string) $v : null, - 'MessageAttributes' => !$item->MessageAttribute ? null : $this->populateResultMessageBodyAttributeMap($item->MessageAttribute), - ]); + foreach ($json as $item) { + $items[] = $this->populateResultMessage($item); } return $items; @@ -98,12 +106,11 @@ private function populateResultMessageList(\SimpleXMLElement $xml): array /** * @return array */ - private function populateResultMessageSystemAttributeMap(\SimpleXMLElement $xml): array + private function populateResultMessageSystemAttributeMap(array $json): array { $items = []; - foreach ($xml as $item) { - $a = $item->Value; - $items[$item->Name->__toString()] = (string) $a; + foreach ($json as $name => $value) { + $items[(string) $name] = (string) $value; } return $items; @@ -112,11 +119,11 @@ private function populateResultMessageSystemAttributeMap(\SimpleXMLElement $xml) /** * @return string[] */ - private function populateResultStringList(\SimpleXMLElement $xml): array + private function populateResultStringList(array $json): array { $items = []; - foreach ($xml->StringListValue as $item) { - $a = ($v = $item) ? (string) $v : null; + foreach ($json as $item) { + $a = isset($item) ? (string) $item : null; if (null !== $a) { $items[] = $a; } diff --git a/src/Service/Sqs/src/Result/SendMessageBatchResult.php b/src/Service/Sqs/src/Result/SendMessageBatchResult.php index b075273ec..644e2ef1a 100644 --- a/src/Service/Sqs/src/Result/SendMessageBatchResult.php +++ b/src/Service/Sqs/src/Result/SendMessageBatchResult.php @@ -49,46 +49,55 @@ public function getSuccessful(): array protected function populateResult(Response $response): void { - $data = new \SimpleXMLElement($response->getContent()); - $data = $data->SendMessageBatchResult; + $data = $response->toArray(); - $this->successful = $this->populateResultSendMessageBatchResultEntryList($data->SendMessageBatchResultEntry); - $this->failed = $this->populateResultBatchResultErrorEntryList($data->BatchResultErrorEntry); + $this->successful = $this->populateResultSendMessageBatchResultEntryList($data['Successful']); + $this->failed = $this->populateResultBatchResultErrorEntryList($data['Failed']); + } + + private function populateResultBatchResultErrorEntry(array $json): BatchResultErrorEntry + { + return new BatchResultErrorEntry([ + 'Id' => (string) $json['Id'], + 'SenderFault' => filter_var($json['SenderFault'], \FILTER_VALIDATE_BOOLEAN), + 'Code' => (string) $json['Code'], + 'Message' => isset($json['Message']) ? (string) $json['Message'] : null, + ]); } /** * @return BatchResultErrorEntry[] */ - private function populateResultBatchResultErrorEntryList(\SimpleXMLElement $xml): array + private function populateResultBatchResultErrorEntryList(array $json): array { $items = []; - foreach ($xml as $item) { - $items[] = new BatchResultErrorEntry([ - 'Id' => (string) $item->Id, - 'SenderFault' => filter_var((string) $item->SenderFault, \FILTER_VALIDATE_BOOLEAN), - 'Code' => (string) $item->Code, - 'Message' => ($v = $item->Message) ? (string) $v : null, - ]); + foreach ($json as $item) { + $items[] = $this->populateResultBatchResultErrorEntry($item); } return $items; } + private function populateResultSendMessageBatchResultEntry(array $json): SendMessageBatchResultEntry + { + return new SendMessageBatchResultEntry([ + 'Id' => (string) $json['Id'], + 'MessageId' => (string) $json['MessageId'], + 'MD5OfMessageBody' => (string) $json['MD5OfMessageBody'], + 'MD5OfMessageAttributes' => isset($json['MD5OfMessageAttributes']) ? (string) $json['MD5OfMessageAttributes'] : null, + 'MD5OfMessageSystemAttributes' => isset($json['MD5OfMessageSystemAttributes']) ? (string) $json['MD5OfMessageSystemAttributes'] : null, + 'SequenceNumber' => isset($json['SequenceNumber']) ? (string) $json['SequenceNumber'] : null, + ]); + } + /** * @return SendMessageBatchResultEntry[] */ - private function populateResultSendMessageBatchResultEntryList(\SimpleXMLElement $xml): array + private function populateResultSendMessageBatchResultEntryList(array $json): array { $items = []; - foreach ($xml as $item) { - $items[] = new SendMessageBatchResultEntry([ - 'Id' => (string) $item->Id, - 'MessageId' => (string) $item->MessageId, - 'MD5OfMessageBody' => (string) $item->MD5OfMessageBody, - 'MD5OfMessageAttributes' => ($v = $item->MD5OfMessageAttributes) ? (string) $v : null, - 'MD5OfMessageSystemAttributes' => ($v = $item->MD5OfMessageSystemAttributes) ? (string) $v : null, - 'SequenceNumber' => ($v = $item->SequenceNumber) ? (string) $v : null, - ]); + foreach ($json as $item) { + $items[] = $this->populateResultSendMessageBatchResultEntry($item); } return $items; diff --git a/src/Service/Sqs/src/Result/SendMessageResult.php b/src/Service/Sqs/src/Result/SendMessageResult.php index 3f945a1fe..f17316963 100644 --- a/src/Service/Sqs/src/Result/SendMessageResult.php +++ b/src/Service/Sqs/src/Result/SendMessageResult.php @@ -98,13 +98,12 @@ public function getSequenceNumber(): ?string protected function populateResult(Response $response): void { - $data = new \SimpleXMLElement($response->getContent()); - $data = $data->SendMessageResult; - - $this->md5OfMessageBody = ($v = $data->MD5OfMessageBody) ? (string) $v : null; - $this->md5OfMessageAttributes = ($v = $data->MD5OfMessageAttributes) ? (string) $v : null; - $this->md5OfMessageSystemAttributes = ($v = $data->MD5OfMessageSystemAttributes) ? (string) $v : null; - $this->messageId = ($v = $data->MessageId) ? (string) $v : null; - $this->sequenceNumber = ($v = $data->SequenceNumber) ? (string) $v : null; + $data = $response->toArray(); + + $this->md5OfMessageBody = isset($data['MD5OfMessageBody']) ? (string) $data['MD5OfMessageBody'] : null; + $this->md5OfMessageAttributes = isset($data['MD5OfMessageAttributes']) ? (string) $data['MD5OfMessageAttributes'] : null; + $this->md5OfMessageSystemAttributes = isset($data['MD5OfMessageSystemAttributes']) ? (string) $data['MD5OfMessageSystemAttributes'] : null; + $this->messageId = isset($data['MessageId']) ? (string) $data['MessageId'] : null; + $this->sequenceNumber = isset($data['SequenceNumber']) ? (string) $data['SequenceNumber'] : null; } } diff --git a/src/Service/Sqs/src/SqsClient.php b/src/Service/Sqs/src/SqsClient.php index a088c01b1..15743ffe1 100644 --- a/src/Service/Sqs/src/SqsClient.php +++ b/src/Service/Sqs/src/SqsClient.php @@ -4,7 +4,7 @@ use AsyncAws\Core\AbstractApi; use AsyncAws\Core\AwsError\AwsErrorFactoryInterface; -use AsyncAws\Core\AwsError\XmlAwsErrorFactory; +use AsyncAws\Core\AwsError\JsonRpcAwsErrorFactory; use AsyncAws\Core\Configuration; use AsyncAws\Core\RequestContext; use AsyncAws\Core\Result; @@ -14,10 +14,20 @@ use AsyncAws\Sqs\Exception\BatchEntryIdsNotDistinctException; use AsyncAws\Sqs\Exception\BatchRequestTooLongException; use AsyncAws\Sqs\Exception\EmptyBatchRequestException; +use AsyncAws\Sqs\Exception\InvalidAddressException; use AsyncAws\Sqs\Exception\InvalidAttributeNameException; +use AsyncAws\Sqs\Exception\InvalidAttributeValueException; use AsyncAws\Sqs\Exception\InvalidBatchEntryIdException; use AsyncAws\Sqs\Exception\InvalidIdFormatException; use AsyncAws\Sqs\Exception\InvalidMessageContentsException; +use AsyncAws\Sqs\Exception\InvalidSecurityException; +use AsyncAws\Sqs\Exception\KmsAccessDeniedException; +use AsyncAws\Sqs\Exception\KmsDisabledException; +use AsyncAws\Sqs\Exception\KmsInvalidKeyUsageException; +use AsyncAws\Sqs\Exception\KmsInvalidStateException; +use AsyncAws\Sqs\Exception\KmsNotFoundException; +use AsyncAws\Sqs\Exception\KmsOptInRequiredException; +use AsyncAws\Sqs\Exception\KmsThrottledException; use AsyncAws\Sqs\Exception\MessageNotInflightException; use AsyncAws\Sqs\Exception\OverLimitException; use AsyncAws\Sqs\Exception\PurgeQueueInProgressException; @@ -25,6 +35,7 @@ use AsyncAws\Sqs\Exception\QueueDoesNotExistException; use AsyncAws\Sqs\Exception\QueueNameExistsException; use AsyncAws\Sqs\Exception\ReceiptHandleIsInvalidException; +use AsyncAws\Sqs\Exception\RequestThrottledException; use AsyncAws\Sqs\Exception\TooManyEntriesInBatchRequestException; use AsyncAws\Sqs\Exception\UnsupportedOperationException; use AsyncAws\Sqs\Input\ChangeMessageVisibilityBatchRequest; @@ -114,13 +125,23 @@ class SqsClient extends AbstractApi * * @throws MessageNotInflightException * @throws ReceiptHandleIsInvalidException + * @throws RequestThrottledException + * @throws QueueDoesNotExistException + * @throws UnsupportedOperationException + * @throws InvalidAddressException + * @throws InvalidSecurityException */ public function changeMessageVisibility($input): Result { $input = ChangeMessageVisibilityRequest::create($input); $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'ChangeMessageVisibility', 'region' => $input->getRegion(), 'exceptionMapping' => [ - 'AWS.SimpleQueueService.MessageNotInflight' => MessageNotInflightException::class, + 'MessageNotInflight' => MessageNotInflightException::class, 'ReceiptHandleIsInvalid' => ReceiptHandleIsInvalidException::class, + 'RequestThrottled' => RequestThrottledException::class, + 'QueueDoesNotExist' => QueueDoesNotExistException::class, + 'UnsupportedOperation' => UnsupportedOperationException::class, + 'InvalidAddress' => InvalidAddressException::class, + 'InvalidSecurity' => InvalidSecurityException::class, ]])); return new Result($response); @@ -147,15 +168,25 @@ public function changeMessageVisibility($input): Result * @throws EmptyBatchRequestException * @throws BatchEntryIdsNotDistinctException * @throws InvalidBatchEntryIdException + * @throws RequestThrottledException + * @throws QueueDoesNotExistException + * @throws UnsupportedOperationException + * @throws InvalidAddressException + * @throws InvalidSecurityException */ public function changeMessageVisibilityBatch($input): ChangeMessageVisibilityBatchResult { $input = ChangeMessageVisibilityBatchRequest::create($input); $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'ChangeMessageVisibilityBatch', 'region' => $input->getRegion(), 'exceptionMapping' => [ - 'AWS.SimpleQueueService.TooManyEntriesInBatchRequest' => TooManyEntriesInBatchRequestException::class, - 'AWS.SimpleQueueService.EmptyBatchRequest' => EmptyBatchRequestException::class, - 'AWS.SimpleQueueService.BatchEntryIdsNotDistinct' => BatchEntryIdsNotDistinctException::class, - 'AWS.SimpleQueueService.InvalidBatchEntryId' => InvalidBatchEntryIdException::class, + 'TooManyEntriesInBatchRequest' => TooManyEntriesInBatchRequestException::class, + 'EmptyBatchRequest' => EmptyBatchRequestException::class, + 'BatchEntryIdsNotDistinct' => BatchEntryIdsNotDistinctException::class, + 'InvalidBatchEntryId' => InvalidBatchEntryIdException::class, + 'RequestThrottled' => RequestThrottledException::class, + 'QueueDoesNotExist' => QueueDoesNotExistException::class, + 'UnsupportedOperation' => UnsupportedOperationException::class, + 'InvalidAddress' => InvalidAddressException::class, + 'InvalidSecurity' => InvalidSecurityException::class, ]])); return new ChangeMessageVisibilityBatchResult($response); @@ -206,13 +237,25 @@ public function changeMessageVisibilityBatch($input): ChangeMessageVisibilityBat * * @throws QueueDeletedRecentlyException * @throws QueueNameExistsException + * @throws RequestThrottledException + * @throws InvalidAddressException + * @throws InvalidAttributeNameException + * @throws InvalidAttributeValueException + * @throws UnsupportedOperationException + * @throws InvalidSecurityException */ public function createQueue($input): CreateQueueResult { $input = CreateQueueRequest::create($input); $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'CreateQueue', 'region' => $input->getRegion(), 'exceptionMapping' => [ - 'AWS.SimpleQueueService.QueueDeletedRecently' => QueueDeletedRecentlyException::class, - 'QueueAlreadyExists' => QueueNameExistsException::class, + 'QueueDeletedRecently' => QueueDeletedRecentlyException::class, + 'QueueNameExists' => QueueNameExistsException::class, + 'RequestThrottled' => RequestThrottledException::class, + 'InvalidAddress' => InvalidAddressException::class, + 'InvalidAttributeName' => InvalidAttributeNameException::class, + 'InvalidAttributeValue' => InvalidAttributeValueException::class, + 'UnsupportedOperation' => UnsupportedOperationException::class, + 'InvalidSecurity' => InvalidSecurityException::class, ]])); return new CreateQueueResult($response); @@ -246,6 +289,11 @@ public function createQueue($input): CreateQueueResult * * @throws InvalidIdFormatException * @throws ReceiptHandleIsInvalidException + * @throws RequestThrottledException + * @throws QueueDoesNotExistException + * @throws UnsupportedOperationException + * @throws InvalidSecurityException + * @throws InvalidAddressException */ public function deleteMessage($input): Result { @@ -253,6 +301,11 @@ public function deleteMessage($input): Result $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'DeleteMessage', 'region' => $input->getRegion(), 'exceptionMapping' => [ 'InvalidIdFormat' => InvalidIdFormatException::class, 'ReceiptHandleIsInvalid' => ReceiptHandleIsInvalidException::class, + 'RequestThrottled' => RequestThrottledException::class, + 'QueueDoesNotExist' => QueueDoesNotExistException::class, + 'UnsupportedOperation' => UnsupportedOperationException::class, + 'InvalidSecurity' => InvalidSecurityException::class, + 'InvalidAddress' => InvalidAddressException::class, ]])); return new Result($response); @@ -278,15 +331,25 @@ public function deleteMessage($input): Result * @throws EmptyBatchRequestException * @throws BatchEntryIdsNotDistinctException * @throws InvalidBatchEntryIdException + * @throws RequestThrottledException + * @throws QueueDoesNotExistException + * @throws UnsupportedOperationException + * @throws InvalidAddressException + * @throws InvalidSecurityException */ public function deleteMessageBatch($input): DeleteMessageBatchResult { $input = DeleteMessageBatchRequest::create($input); $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'DeleteMessageBatch', 'region' => $input->getRegion(), 'exceptionMapping' => [ - 'AWS.SimpleQueueService.TooManyEntriesInBatchRequest' => TooManyEntriesInBatchRequestException::class, - 'AWS.SimpleQueueService.EmptyBatchRequest' => EmptyBatchRequestException::class, - 'AWS.SimpleQueueService.BatchEntryIdsNotDistinct' => BatchEntryIdsNotDistinctException::class, - 'AWS.SimpleQueueService.InvalidBatchEntryId' => InvalidBatchEntryIdException::class, + 'TooManyEntriesInBatchRequest' => TooManyEntriesInBatchRequestException::class, + 'EmptyBatchRequest' => EmptyBatchRequestException::class, + 'BatchEntryIdsNotDistinct' => BatchEntryIdsNotDistinctException::class, + 'InvalidBatchEntryId' => InvalidBatchEntryIdException::class, + 'RequestThrottled' => RequestThrottledException::class, + 'QueueDoesNotExist' => QueueDoesNotExistException::class, + 'UnsupportedOperation' => UnsupportedOperationException::class, + 'InvalidAddress' => InvalidAddressException::class, + 'InvalidSecurity' => InvalidSecurityException::class, ]])); return new DeleteMessageBatchResult($response); @@ -318,11 +381,23 @@ public function deleteMessageBatch($input): DeleteMessageBatchResult * QueueUrl: string, * '@region'?: string|null, * }|DeleteQueueRequest $input + * + * @throws RequestThrottledException + * @throws QueueDoesNotExistException + * @throws InvalidAddressException + * @throws UnsupportedOperationException + * @throws InvalidSecurityException */ public function deleteQueue($input): Result { $input = DeleteQueueRequest::create($input); - $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'DeleteQueue', 'region' => $input->getRegion()])); + $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'DeleteQueue', 'region' => $input->getRegion(), 'exceptionMapping' => [ + 'RequestThrottled' => RequestThrottledException::class, + 'QueueDoesNotExist' => QueueDoesNotExistException::class, + 'InvalidAddress' => InvalidAddressException::class, + 'UnsupportedOperation' => UnsupportedOperationException::class, + 'InvalidSecurity' => InvalidSecurityException::class, + ]])); return new Result($response); } @@ -344,12 +419,22 @@ public function deleteQueue($input): Result * }|GetQueueAttributesRequest $input * * @throws InvalidAttributeNameException + * @throws RequestThrottledException + * @throws QueueDoesNotExistException + * @throws UnsupportedOperationException + * @throws InvalidSecurityException + * @throws InvalidAddressException */ public function getQueueAttributes($input): GetQueueAttributesResult { $input = GetQueueAttributesRequest::create($input); $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'GetQueueAttributes', 'region' => $input->getRegion(), 'exceptionMapping' => [ 'InvalidAttributeName' => InvalidAttributeNameException::class, + 'RequestThrottled' => RequestThrottledException::class, + 'QueueDoesNotExist' => QueueDoesNotExistException::class, + 'UnsupportedOperation' => UnsupportedOperationException::class, + 'InvalidSecurity' => InvalidSecurityException::class, + 'InvalidAddress' => InvalidAddressException::class, ]])); return new GetQueueAttributesResult($response); @@ -374,13 +459,21 @@ public function getQueueAttributes($input): GetQueueAttributesResult * '@region'?: string|null, * }|GetQueueUrlRequest $input * + * @throws RequestThrottledException * @throws QueueDoesNotExistException + * @throws InvalidAddressException + * @throws InvalidSecurityException + * @throws UnsupportedOperationException */ public function getQueueUrl($input): GetQueueUrlResult { $input = GetQueueUrlRequest::create($input); $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'GetQueueUrl', 'region' => $input->getRegion(), 'exceptionMapping' => [ - 'AWS.SimpleQueueService.NonExistentQueue' => QueueDoesNotExistException::class, + 'RequestThrottled' => RequestThrottledException::class, + 'QueueDoesNotExist' => QueueDoesNotExistException::class, + 'InvalidAddress' => InvalidAddressException::class, + 'InvalidSecurity' => InvalidSecurityException::class, + 'UnsupportedOperation' => UnsupportedOperationException::class, ]])); return new GetQueueUrlResult($response); @@ -410,11 +503,21 @@ public function getQueueUrl($input): GetQueueUrlResult * MaxResults?: null|int, * '@region'?: string|null, * }|ListQueuesRequest $input + * + * @throws RequestThrottledException + * @throws InvalidSecurityException + * @throws InvalidAddressException + * @throws UnsupportedOperationException */ public function listQueues($input = []): ListQueuesResult { $input = ListQueuesRequest::create($input); - $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'ListQueues', 'region' => $input->getRegion()])); + $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'ListQueues', 'region' => $input->getRegion(), 'exceptionMapping' => [ + 'RequestThrottled' => RequestThrottledException::class, + 'InvalidSecurity' => InvalidSecurityException::class, + 'InvalidAddress' => InvalidAddressException::class, + 'UnsupportedOperation' => UnsupportedOperationException::class, + ]])); return new ListQueuesResult($response, $this, $input); } @@ -441,13 +544,21 @@ public function listQueues($input = []): ListQueuesResult * * @throws QueueDoesNotExistException * @throws PurgeQueueInProgressException + * @throws RequestThrottledException + * @throws InvalidAddressException + * @throws InvalidSecurityException + * @throws UnsupportedOperationException */ public function purgeQueue($input): Result { $input = PurgeQueueRequest::create($input); $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'PurgeQueue', 'region' => $input->getRegion(), 'exceptionMapping' => [ - 'AWS.SimpleQueueService.NonExistentQueue' => QueueDoesNotExistException::class, - 'AWS.SimpleQueueService.PurgeQueueInProgress' => PurgeQueueInProgressException::class, + 'QueueDoesNotExist' => QueueDoesNotExistException::class, + 'PurgeQueueInProgress' => PurgeQueueInProgressException::class, + 'RequestThrottled' => RequestThrottledException::class, + 'InvalidAddress' => InvalidAddressException::class, + 'InvalidSecurity' => InvalidSecurityException::class, + 'UnsupportedOperation' => UnsupportedOperationException::class, ]])); return new Result($response); @@ -466,7 +577,11 @@ public function queueExists($input): QueueExistsWaiter { $input = GetQueueUrlRequest::create($input); $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'GetQueueUrl', 'region' => $input->getRegion(), 'exceptionMapping' => [ - 'AWS.SimpleQueueService.NonExistentQueue' => QueueDoesNotExistException::class, + 'RequestThrottled' => RequestThrottledException::class, + 'QueueDoesNotExist' => QueueDoesNotExistException::class, + 'InvalidAddress' => InvalidAddressException::class, + 'InvalidSecurity' => InvalidSecurityException::class, + 'UnsupportedOperation' => UnsupportedOperationException::class, ]])); return new QueueExistsWaiter($response, $this, $input); @@ -525,13 +640,37 @@ public function queueExists($input): QueueExistsWaiter * '@region'?: string|null, * }|ReceiveMessageRequest $input * + * @throws UnsupportedOperationException * @throws OverLimitException + * @throws RequestThrottledException + * @throws QueueDoesNotExistException + * @throws InvalidSecurityException + * @throws KmsDisabledException + * @throws KmsInvalidStateException + * @throws KmsNotFoundException + * @throws KmsOptInRequiredException + * @throws KmsThrottledException + * @throws KmsAccessDeniedException + * @throws KmsInvalidKeyUsageException + * @throws InvalidAddressException */ public function receiveMessage($input): ReceiveMessageResult { $input = ReceiveMessageRequest::create($input); $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'ReceiveMessage', 'region' => $input->getRegion(), 'exceptionMapping' => [ + 'UnsupportedOperation' => UnsupportedOperationException::class, 'OverLimit' => OverLimitException::class, + 'RequestThrottled' => RequestThrottledException::class, + 'QueueDoesNotExist' => QueueDoesNotExistException::class, + 'InvalidSecurity' => InvalidSecurityException::class, + 'KmsDisabled' => KmsDisabledException::class, + 'KmsInvalidState' => KmsInvalidStateException::class, + 'KmsNotFound' => KmsNotFoundException::class, + 'KmsOptInRequired' => KmsOptInRequiredException::class, + 'KmsThrottled' => KmsThrottledException::class, + 'KmsAccessDenied' => KmsAccessDeniedException::class, + 'KmsInvalidKeyUsage' => KmsInvalidKeyUsageException::class, + 'InvalidAddress' => InvalidAddressException::class, ]])); return new ReceiveMessageResult($response); @@ -565,13 +704,35 @@ public function receiveMessage($input): ReceiveMessageResult * * @throws InvalidMessageContentsException * @throws UnsupportedOperationException + * @throws RequestThrottledException + * @throws QueueDoesNotExistException + * @throws InvalidSecurityException + * @throws KmsDisabledException + * @throws KmsInvalidStateException + * @throws KmsNotFoundException + * @throws KmsOptInRequiredException + * @throws KmsThrottledException + * @throws KmsAccessDeniedException + * @throws KmsInvalidKeyUsageException + * @throws InvalidAddressException */ public function sendMessage($input): SendMessageResult { $input = SendMessageRequest::create($input); $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'SendMessage', 'region' => $input->getRegion(), 'exceptionMapping' => [ 'InvalidMessageContents' => InvalidMessageContentsException::class, - 'AWS.SimpleQueueService.UnsupportedOperation' => UnsupportedOperationException::class, + 'UnsupportedOperation' => UnsupportedOperationException::class, + 'RequestThrottled' => RequestThrottledException::class, + 'QueueDoesNotExist' => QueueDoesNotExistException::class, + 'InvalidSecurity' => InvalidSecurityException::class, + 'KmsDisabled' => KmsDisabledException::class, + 'KmsInvalidState' => KmsInvalidStateException::class, + 'KmsNotFound' => KmsNotFoundException::class, + 'KmsOptInRequired' => KmsOptInRequiredException::class, + 'KmsThrottled' => KmsThrottledException::class, + 'KmsAccessDenied' => KmsAccessDeniedException::class, + 'KmsInvalidKeyUsage' => KmsInvalidKeyUsageException::class, + 'InvalidAddress' => InvalidAddressException::class, ]])); return new SendMessageResult($response); @@ -615,17 +776,39 @@ public function sendMessage($input): SendMessageResult * @throws BatchRequestTooLongException * @throws InvalidBatchEntryIdException * @throws UnsupportedOperationException + * @throws RequestThrottledException + * @throws QueueDoesNotExistException + * @throws InvalidSecurityException + * @throws KmsDisabledException + * @throws KmsInvalidStateException + * @throws KmsNotFoundException + * @throws KmsOptInRequiredException + * @throws KmsThrottledException + * @throws KmsAccessDeniedException + * @throws KmsInvalidKeyUsageException + * @throws InvalidAddressException */ public function sendMessageBatch($input): SendMessageBatchResult { $input = SendMessageBatchRequest::create($input); $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'SendMessageBatch', 'region' => $input->getRegion(), 'exceptionMapping' => [ - 'AWS.SimpleQueueService.TooManyEntriesInBatchRequest' => TooManyEntriesInBatchRequestException::class, - 'AWS.SimpleQueueService.EmptyBatchRequest' => EmptyBatchRequestException::class, - 'AWS.SimpleQueueService.BatchEntryIdsNotDistinct' => BatchEntryIdsNotDistinctException::class, - 'AWS.SimpleQueueService.BatchRequestTooLong' => BatchRequestTooLongException::class, - 'AWS.SimpleQueueService.InvalidBatchEntryId' => InvalidBatchEntryIdException::class, - 'AWS.SimpleQueueService.UnsupportedOperation' => UnsupportedOperationException::class, + 'TooManyEntriesInBatchRequest' => TooManyEntriesInBatchRequestException::class, + 'EmptyBatchRequest' => EmptyBatchRequestException::class, + 'BatchEntryIdsNotDistinct' => BatchEntryIdsNotDistinctException::class, + 'BatchRequestTooLong' => BatchRequestTooLongException::class, + 'InvalidBatchEntryId' => InvalidBatchEntryIdException::class, + 'UnsupportedOperation' => UnsupportedOperationException::class, + 'RequestThrottled' => RequestThrottledException::class, + 'QueueDoesNotExist' => QueueDoesNotExistException::class, + 'InvalidSecurity' => InvalidSecurityException::class, + 'KmsDisabled' => KmsDisabledException::class, + 'KmsInvalidState' => KmsInvalidStateException::class, + 'KmsNotFound' => KmsNotFoundException::class, + 'KmsOptInRequired' => KmsOptInRequiredException::class, + 'KmsThrottled' => KmsThrottledException::class, + 'KmsAccessDenied' => KmsAccessDeniedException::class, + 'KmsInvalidKeyUsage' => KmsInvalidKeyUsageException::class, + 'InvalidAddress' => InvalidAddressException::class, ]])); return new SendMessageBatchResult($response); @@ -633,7 +816,7 @@ public function sendMessageBatch($input): SendMessageBatchResult protected function getAwsErrorFactory(): AwsErrorFactoryInterface { - return new XmlAwsErrorFactory(); + return new JsonRpcAwsErrorFactory(); } protected function getEndpointMetadata(?string $region): array diff --git a/src/Service/Sqs/src/ValueObject/MessageAttributeValue.php b/src/Service/Sqs/src/ValueObject/MessageAttributeValue.php index f8ef25ac4..6267aadf7 100644 --- a/src/Service/Sqs/src/ValueObject/MessageAttributeValue.php +++ b/src/Service/Sqs/src/ValueObject/MessageAttributeValue.php @@ -132,17 +132,19 @@ public function requestBody(): array $payload['BinaryValue'] = base64_encode($v); } if (null !== $v = $this->stringListValues) { - $index = 0; - foreach ($v as $mapValue) { + $index = -1; + $payload['StringListValues'] = []; + foreach ($v as $listValue) { ++$index; - $payload["StringListValue.$index"] = $mapValue; + $payload['StringListValues'][$index] = $listValue; } } if (null !== $v = $this->binaryListValues) { - $index = 0; - foreach ($v as $mapValue) { + $index = -1; + $payload['BinaryListValues'] = []; + foreach ($v as $listValue) { ++$index; - $payload["BinaryListValue.$index"] = base64_encode($mapValue); + $payload['BinaryListValues'][$index] = base64_encode($listValue); } } $v = $this->dataType; diff --git a/src/Service/Sqs/src/ValueObject/MessageSystemAttributeValue.php b/src/Service/Sqs/src/ValueObject/MessageSystemAttributeValue.php index b85eb7ea6..2e4ee200e 100644 --- a/src/Service/Sqs/src/ValueObject/MessageSystemAttributeValue.php +++ b/src/Service/Sqs/src/ValueObject/MessageSystemAttributeValue.php @@ -131,17 +131,19 @@ public function requestBody(): array $payload['BinaryValue'] = base64_encode($v); } if (null !== $v = $this->stringListValues) { - $index = 0; - foreach ($v as $mapValue) { + $index = -1; + $payload['StringListValues'] = []; + foreach ($v as $listValue) { ++$index; - $payload["StringListValue.$index"] = $mapValue; + $payload['StringListValues'][$index] = $listValue; } } if (null !== $v = $this->binaryListValues) { - $index = 0; - foreach ($v as $mapValue) { + $index = -1; + $payload['BinaryListValues'] = []; + foreach ($v as $listValue) { ++$index; - $payload["BinaryListValue.$index"] = base64_encode($mapValue); + $payload['BinaryListValues'][$index] = base64_encode($listValue); } } $v = $this->dataType; diff --git a/src/Service/Sqs/src/ValueObject/SendMessageBatchRequestEntry.php b/src/Service/Sqs/src/ValueObject/SendMessageBatchRequestEntry.php index a134c6303..d4e067a44 100644 --- a/src/Service/Sqs/src/ValueObject/SendMessageBatchRequestEntry.php +++ b/src/Service/Sqs/src/ValueObject/SendMessageBatchRequestEntry.php @@ -229,25 +229,25 @@ public function requestBody(): array $payload['DelaySeconds'] = $v; } if (null !== $v = $this->messageAttributes) { - $index = 0; - foreach ($v as $mapKey => $mapValue) { - ++$index; - $payload["MessageAttribute.$index.Name"] = $mapKey; - foreach ($mapValue->requestBody() as $bodyKey => $bodyValue) { - $payload["MessageAttribute.$index.Value.$bodyKey"] = $bodyValue; + if (empty($v)) { + $payload['MessageAttributes'] = new \stdClass(); + } else { + $payload['MessageAttributes'] = []; + foreach ($v as $name => $mv) { + $payload['MessageAttributes'][$name] = $mv->requestBody(); } } } if (null !== $v = $this->messageSystemAttributes) { - $index = 0; - foreach ($v as $mapKey => $mapValue) { - if (!MessageSystemAttributeNameForSends::exists($mapKey)) { - throw new InvalidArgument(sprintf('Invalid key for "%s". The value "%s" is not a valid "MessageSystemAttributeNameForSends".', __CLASS__, $mapKey)); - } - ++$index; - $payload["MessageSystemAttribute.$index.Name"] = $mapKey; - foreach ($mapValue->requestBody() as $bodyKey => $bodyValue) { - $payload["MessageSystemAttribute.$index.Value.$bodyKey"] = $bodyValue; + if (empty($v)) { + $payload['MessageSystemAttributes'] = new \stdClass(); + } else { + $payload['MessageSystemAttributes'] = []; + foreach ($v as $name => $mv) { + if (!MessageSystemAttributeNameForSends::exists($name)) { + throw new InvalidArgument(sprintf('Invalid key for "%s". The value "%s" is not a valid "MessageSystemAttributeNameForSends".', __CLASS__, $name)); + } + $payload['MessageSystemAttributes'][$name] = $mv->requestBody(); } } } diff --git a/src/Service/StepFunctions/CHANGELOG.md b/src/Service/StepFunctions/CHANGELOG.md index fda19b61d..a4956f831 100644 --- a/src/Service/StepFunctions/CHANGELOG.md +++ b/src/Service/StepFunctions/CHANGELOG.md @@ -2,6 +2,10 @@ ## NOT RELEASED +### Added + +- AWS api-change: TODO + ### Changed - Allow passing explicit null values for optional fields of input objects diff --git a/src/Service/StepFunctions/src/Exception/TaskDoesNotExistException.php b/src/Service/StepFunctions/src/Exception/TaskDoesNotExistException.php index 65983f36b..fd449db6e 100644 --- a/src/Service/StepFunctions/src/Exception/TaskDoesNotExistException.php +++ b/src/Service/StepFunctions/src/Exception/TaskDoesNotExistException.php @@ -4,6 +4,9 @@ use AsyncAws\Core\Exception\Http\ClientException; +/** + * The activity does not exist. + */ final class TaskDoesNotExistException extends ClientException { } diff --git a/src/Service/StepFunctions/src/Exception/TaskTimedOutException.php b/src/Service/StepFunctions/src/Exception/TaskTimedOutException.php index 4528ace47..fc0af86ce 100644 --- a/src/Service/StepFunctions/src/Exception/TaskTimedOutException.php +++ b/src/Service/StepFunctions/src/Exception/TaskTimedOutException.php @@ -4,6 +4,9 @@ use AsyncAws\Core\Exception\Http\ClientException; +/** + * The task token has either expired or the task associated with the token has already been closed. + */ final class TaskTimedOutException extends ClientException { } diff --git a/src/Service/StepFunctions/src/Input/StartExecutionInput.php b/src/Service/StepFunctions/src/Input/StartExecutionInput.php index f6380077d..0d68c1be5 100644 --- a/src/Service/StepFunctions/src/Input/StartExecutionInput.php +++ b/src/Service/StepFunctions/src/Input/StartExecutionInput.php @@ -47,6 +47,9 @@ final class StartExecutionInput extends Input * machine for 90 days. For more information, see Limits Related to State Machine Executions [^1] in the *Step Functions * Developer Guide*. * + * If you don't provide a name for the execution, Step Functions automatically generates a universally unique identifier + * (UUID) as the execution name. + * * A name must *not* contain: * * - white space diff --git a/src/Service/StepFunctions/src/StepFunctionsClient.php b/src/Service/StepFunctions/src/StepFunctionsClient.php index 1f89e7cc3..74e430c25 100644 --- a/src/Service/StepFunctions/src/StepFunctionsClient.php +++ b/src/Service/StepFunctions/src/StepFunctionsClient.php @@ -34,10 +34,11 @@ class StepFunctionsClient extends AbstractApi { /** - * Used by activity workers and task states using the callback [^1] pattern to report that the task identified by the - * `taskToken` failed. + * Used by activity workers, Task states using the callback [^1] pattern, and optionally Task states using the job run + * [^2] pattern to report that the task identified by the `taskToken` failed. * * [^1]: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token + * [^2]: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-sync * * @see https://docs.aws.amazon.com/step-functions/latest/apireference/API_SendTaskFailure.html * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-states-2016-11-23.html#sendtaskfailure @@ -66,12 +67,12 @@ public function sendTaskFailure($input): SendTaskFailureOutput } /** - * Used by activity workers and task states using the callback [^1] pattern to report to Step Functions that the task - * represented by the specified `taskToken` is still making progress. This action resets the `Heartbeat` clock. The - * `Heartbeat` threshold is specified in the state machine's Amazon States Language definition (`HeartbeatSeconds`). - * This action does not in itself create an event in the execution history. However, if the task times out, the - * execution history contains an `ActivityTimedOut` entry for activities, or a `TaskTimedOut` entry for for tasks using - * the job run [^2] or callback [^3] pattern. + * Used by activity workers and Task states using the callback [^1] pattern, and optionally Task states using the job + * run [^2] pattern to report to Step Functions that the task represented by the specified `taskToken` is still making + * progress. This action resets the `Heartbeat` clock. The `Heartbeat` threshold is specified in the state machine's + * Amazon States Language definition (`HeartbeatSeconds`). This action does not in itself create an event in the + * execution history. However, if the task times out, the execution history contains an `ActivityTimedOut` entry for + * activities, or a `TaskTimedOut` entry for tasks using the job run [^3] or callback [^4] pattern. * * > The `Timeout` of a task, defined in the state machine's Amazon States Language definition, is its maximum allowed * > duration, regardless of the number of SendTaskHeartbeat requests received. Use `HeartbeatSeconds` to configure the @@ -79,7 +80,8 @@ public function sendTaskFailure($input): SendTaskFailureOutput * * [^1]: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token * [^2]: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-sync - * [^3]: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token + * [^3]: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-sync + * [^4]: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token * * @see https://docs.aws.amazon.com/step-functions/latest/apireference/API_SendTaskHeartbeat.html * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-states-2016-11-23.html#sendtaskheartbeat @@ -106,10 +108,11 @@ public function sendTaskHeartbeat($input): SendTaskHeartbeatOutput } /** - * Used by activity workers and task states using the callback [^1] pattern to report that the task identified by the - * `taskToken` completed successfully. + * Used by activity workers, Task states using the callback [^1] pattern, and optionally Task states using the job run + * [^2] pattern to report that the task identified by the `taskToken` completed successfully. * * [^1]: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token + * [^2]: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-sync * * @see https://docs.aws.amazon.com/step-functions/latest/apireference/API_SendTaskSuccess.html * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-states-2016-11-23.html#sendtasksuccess