diff --git a/manifest.json b/manifest.json index a98c28cfe..ee7697cb5 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "variables": { - "${LATEST}": "3.284.1" + "${LATEST}": "3.288.1" }, "endpoints": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/endpoints.json", "services": { diff --git a/psalm.baseline.xml b/psalm.baseline.xml index 08bde4c61..e047a6c56 100644 --- a/psalm.baseline.xml +++ b/psalm.baseline.xml @@ -204,8 +204,10 @@ $items $items + $items + ]]> ]]> ]]> @@ -214,8 +216,10 @@ $items $items + $items + ]]> ]]> ]]> @@ -224,8 +228,10 @@ $items $items + $items + ]]> ]]> ]]> @@ -272,6 +278,22 @@ + + + $items + + + ]]> + + + + + $items + + + ]]> + + 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/Kinesis/CHANGELOG.md b/src/Service/Kinesis/CHANGELOG.md index fcc84fd24..a3ac741d1 100644 --- a/src/Service/Kinesis/CHANGELOG.md +++ b/src/Service/Kinesis/CHANGELOG.md @@ -5,6 +5,7 @@ ### Changed - Allow passing explicit null values for optional fields of input objects +- AWS enhancement: Documentation updates. ## 3.0.0 diff --git a/src/Service/Kinesis/src/KinesisClient.php b/src/Service/Kinesis/src/KinesisClient.php index af2c18190..f24a86479 100644 --- a/src/Service/Kinesis/src/KinesisClient.php +++ b/src/Service/Kinesis/src/KinesisClient.php @@ -80,8 +80,8 @@ class KinesisClient extends AbstractApi /** * Adds or updates tags for the specified Kinesis data stream. You can assign up to 50 tags to a data stream. * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter rather than the `StreamName` - * > input parameter. + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. * * If tags have already been assigned to the stream, `AddTagsToStream` overwrites any existing tags that correspond to * the specified tag keys. @@ -184,8 +184,8 @@ public function createStream($input): Result * Decreases the Kinesis data stream's retention period, which is the length of time data records are accessible after * they are added to the stream. The minimum value of a stream's retention period is 24 hours. * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter rather than the `StreamName` - * > input parameter. + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. * * This operation may result in lost data. For example, if the stream's retention period is 48 hours and is decreased to * 24 hours, any data already in the stream that is older than 24 hours is inaccessible. @@ -225,8 +225,8 @@ public function decreaseStreamRetentionPeriod($input): Result * the stream before you delete the stream. If an application attempts to operate on a deleted stream, it receives the * exception `ResourceNotFoundException`. * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter rather than the `StreamName` - * > input parameter. + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. * * If the stream is in the `ACTIVE` state, you can delete it. After a `DeleteStream` request, the specified stream is in * the `DELETING` state until Kinesis Data Streams completes the deletion. @@ -339,8 +339,8 @@ public function describeLimits($input = []): DescribeLimitsOutput * > description of the specified Kinesis data stream and the ListShards API to list the shards in a specified data * > stream and obtain information about each shard. * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter rather than the `StreamName` - * > input parameter. + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. * * The information returned includes the stream name, Amazon Resource Name (ARN), creation time, enhanced metric * configuration, and shard map. The shard map is an array of shard objects. For each shard object, there is the hash @@ -396,6 +396,8 @@ public function describeStream($input = []): DescribeStreamOutput * * This operation has a limit of 20 transactions per second per stream. * + * > When making a cross-account call with `DescribeStreamConsumer`, make sure to provide the ARN of the consumer. + * * @see https://docs.aws.amazon.com/kinesis/latest/APIReference/API_DescribeStreamConsumer.html * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-kinesis-2013-12-02.html#describestreamconsumer * @@ -425,8 +427,8 @@ public function describeStreamConsumer($input = []): DescribeStreamConsumerOutpu /** * Provides a summarized description of the specified Kinesis data stream without the shard list. * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter rather than the `StreamName` - * > input parameter. + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. * * The information returned includes the stream name, Amazon Resource Name (ARN), status, record retention period, * approximate creation time, monitoring, encryption details, and open shard count. @@ -463,8 +465,8 @@ public function describeStreamSummary($input = []): DescribeStreamSummaryOutput /** * Disables enhanced monitoring. * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter rather than the `StreamName` - * > input parameter. + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. * * @see https://docs.aws.amazon.com/kinesis/latest/APIReference/API_DisableEnhancedMonitoring.html * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-kinesis-2013-12-02.html#disableenhancedmonitoring @@ -499,8 +501,8 @@ public function disableEnhancedMonitoring($input): EnhancedMonitoringOutput /** * Enables enhanced Kinesis data stream monitoring for shard-level metrics. * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter rather than the `StreamName` - * > input parameter. + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. * * @see https://docs.aws.amazon.com/kinesis/latest/APIReference/API_EnableEnhancedMonitoring.html * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-kinesis-2013-12-02.html#enableenhancedmonitoring @@ -535,8 +537,8 @@ public function enableEnhancedMonitoring($input): EnhancedMonitoringOutput /** * Gets data records from a Kinesis data stream's shard. * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter in addition to the - * > `ShardIterator` parameter. + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. * * Specify a shard iterator using the `ShardIterator` parameter. The shard iterator specifies the position in the shard * from which you want to start reading data records sequentially. If there are no records available in the portion of @@ -628,8 +630,8 @@ public function getRecords($input): GetRecordsOutput /** * Gets an Amazon Kinesis shard iterator. A shard iterator expires 5 minutes after it is returned to the requester. * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter rather than the `StreamName` - * > input parameter. + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. * * A shard iterator specifies the shard position from which to start reading data records sequentially. The position is * specified using the sequence number of a data record in a shard. A sequence number is the identifier associated with @@ -696,8 +698,8 @@ public function getShardIterator($input): GetShardIteratorOutput * Increases the Kinesis data stream's retention period, which is the length of time data records are accessible after * they are added to the stream. The maximum value of a stream's retention period is 8760 hours (365 days). * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter rather than the `StreamName` - * > input parameter. + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. * * If you choose a longer stream retention period, this operation increases the time period during which records that * have not yet expired are accessible. However, it does not make previous, expired data (older than the stream's @@ -739,8 +741,8 @@ public function increaseStreamRetentionPeriod($input): Result * Lists the shards in a stream and provides information about each shard. This operation has a limit of 1000 * transactions per second per data stream. * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter rather than the `StreamName` - * > input parameter. + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. * * This action does not list expired shards. For information about expired shards, see Data Routing, Data Persistence, * and Shard State after a Reshard [^1]. @@ -870,8 +872,8 @@ public function listStreams($input = []): ListStreamsOutput * Lists the tags for the specified Kinesis data stream. This operation has a limit of five transactions per second per * account. * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter rather than the `StreamName` - * > input parameter. + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. * * @see https://docs.aws.amazon.com/kinesis/latest/APIReference/API_ListTagsForStream.html * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-kinesis-2013-12-02.html#listtagsforstream @@ -911,8 +913,8 @@ public function listTagsForStream($input = []): ListTagsForStreamOutput * 276...454. After the merge, the single child shard receives data for all hash key values covered by the two parent * shards. * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter rather than the `StreamName` - * > input parameter. + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. * * `MergeShards` is called when there is a need to reduce the overall capacity of a stream because of excess capacity * that is not being used. You must specify the shard to be merged and the adjacent shard for a stream. For more @@ -977,8 +979,8 @@ public function mergeShards($input): Result * real-time ingestion and subsequent processing, one record at a time. Each shard can support writes up to 1,000 * records per second, up to a maximum data write total of 1 MiB per second. * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter rather than the `StreamName` - * > input parameter. + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. * * You must specify the name of the stream that captures, stores, and transports the data; a partition key; and the data * blob itself. @@ -1062,8 +1064,8 @@ public function putRecord($input): PutRecordOutput * Writes multiple data records into a Kinesis data stream in a single call (also referred to as a `PutRecords` * request). Use this operation to send data into the stream for data ingestion and processing. * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter rather than the `StreamName` - * > input parameter. + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. * * Each `PutRecords` request can support up to 500 records. Each record in the request can be as large as 1 MiB, up to a * limit of 5 MiB for the entire request, including partition keys. Each shard can support writes up to 1,000 records @@ -1203,8 +1205,8 @@ public function registerStreamConsumer($input): RegisterStreamConsumerOutput * Removes tags from the specified Kinesis data stream. Removed tags are deleted and cannot be recovered after this * operation successfully completes. * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter rather than the `StreamName` - * > input parameter. + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. * * If you specify a tag that does not exist, it is ignored. * @@ -1246,8 +1248,8 @@ public function removeTagsFromStream($input): Result * an expected increase in the volume of data records being ingested. This API is only supported for the data streams * with the provisioned capacity mode. * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter rather than the `StreamName` - * > input parameter. + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. * * You can also use `SplitShard` when a shard appears to be approaching its maximum utilization; for example, the * producers sending data into the specific shard are suddenly sending more than previously anticipated. You can also @@ -1321,6 +1323,9 @@ public function splitShard($input): Result /** * Enables or updates server-side encryption using an Amazon Web Services KMS key for a specified stream. * + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. + * * Starting encryption is an asynchronous operation. Upon receiving the request, Kinesis Data Streams returns * immediately and sets the status of the stream to `UPDATING`. After the update is complete, Kinesis Data Streams sets * the status of the stream back to `ACTIVE`. Updating or applying encryption normally takes a few seconds to complete, @@ -1334,9 +1339,6 @@ public function splitShard($input): Result * are encrypted. After you enable encryption, you can verify that encryption is applied by inspecting the API response * from `PutRecord` or `PutRecords`. * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter rather than the `StreamName` - * > input parameter. - * * @see https://docs.aws.amazon.com/kinesis/latest/APIReference/API_StartStreamEncryption.html * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-kinesis-2013-12-02.html#startstreamencryption * @@ -1383,8 +1385,8 @@ public function startStreamEncryption($input): Result /** * Disables server-side encryption for a specified stream. * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter rather than the `StreamName` - * > input parameter. + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. * * Stopping encryption is an asynchronous operation. Upon receiving the request, Kinesis Data Streams returns * immediately and sets the status of the stream to `UPDATING`. After the update is complete, Kinesis Data Streams sets @@ -1481,8 +1483,8 @@ public function streamNotExists($input = []): StreamNotExistsWaiter * Updates the shard count of the specified stream to the specified number of shards. This API is only supported for the * data streams with the provisioned capacity mode. * - * > When invoking this API, it is recommended you use the `StreamARN` input parameter rather than the `StreamName` - * > input parameter. + * > When invoking this API, you must use either the `StreamARN` or the `StreamName` parameter, or both. It is + * > recommended that you use the `StreamARN` input parameter when you invoke this API. * * Updating the shard count is an asynchronous operation. Upon receiving the request, Kinesis Data Streams returns * immediately and sets the status of the stream to `UPDATING`. After the update is complete, Kinesis Data Streams sets @@ -1505,6 +1507,7 @@ public function streamNotExists($input = []): StreamNotExistsWaiter * - Scale up to more than 10000 shards in a stream * - Scale a stream with more than 10000 shards down unless the result is less than 10000 shards * - Scale up to more than the shard limit for your account + * - Make over 10 TPS. TPS over 10 will trigger the LimitExceededException * * For the default limits for an Amazon Web Services account, see Streams Limits [^1] in the *Amazon Kinesis Data * Streams Developer Guide*. To request an increase in the call rate limit, the shard limit for this API, or your 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/Sqs/tests/Integration/SqsClientTest.php b/src/Service/Sqs/tests/Integration/SqsClientTest.php index 0da455e02..bbdb0f961 100644 --- a/src/Service/Sqs/tests/Integration/SqsClientTest.php +++ b/src/Service/Sqs/tests/Integration/SqsClientTest.php @@ -332,6 +332,8 @@ public function testSendMessageBatch(): void private function getClient(): SqsClient { + self::markTestSkipped('The docker image does not (yet) accept JSON payload.'); + return new SqsClient([ 'endpoint' => 'http://localhost:9494', ], new NullProvider()); diff --git a/src/Service/Sqs/tests/Unit/Input/ChangeMessageVisibilityBatchRequestTest.php b/src/Service/Sqs/tests/Unit/Input/ChangeMessageVisibilityBatchRequestTest.php index 7aa4dcf48..4270f11b8 100644 --- a/src/Service/Sqs/tests/Unit/Input/ChangeMessageVisibilityBatchRequestTest.php +++ b/src/Service/Sqs/tests/Unit/Input/ChangeMessageVisibilityBatchRequestTest.php @@ -22,15 +22,19 @@ public function testRequest(): void /** @see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ChangeMessageVisibilityBatch.html */ $expected = ' POST / HTTP/1.0 - Content-Type: application/x-www-form-urlencoded + Content-Type: application/x-amz-json-1.0 + x-amz-target: AmazonSQS.ChangeMessageVisibilityBatch - Action=ChangeMessageVisibilityBatch - &ChangeMessageVisibilityBatchRequestEntry.1.Id=qwertyuiop - &ChangeMessageVisibilityBatchRequestEntry.1.ReceiptHandle=MbZj6wDWli%2BJvwwJaBV%2B3dcjk2YW2vA3%2BSTFFljT - &ChangeMessageVisibilityBatchRequestEntry.1.VisibilityTimeout=60 - &QueueUrl=queueUrl - &Version=2012-11-05 - '; + { + "QueueUrl": "queueUrl", + "Entries": [ + { + "Id": "qwertyuiop", + "ReceiptHandle": "MbZj6wDWli+JvwwJaBV+3dcjk2YW2vA3+STFFljT", + "VisibilityTimeout": 60 + } + ] + }'; self::assertRequestEqualsHttpRequest($expected, $input->request()); } diff --git a/src/Service/Sqs/tests/Unit/Input/ChangeMessageVisibilityRequestTest.php b/src/Service/Sqs/tests/Unit/Input/ChangeMessageVisibilityRequestTest.php index 15ef7d2df..cdc311e47 100644 --- a/src/Service/Sqs/tests/Unit/Input/ChangeMessageVisibilityRequestTest.php +++ b/src/Service/Sqs/tests/Unit/Input/ChangeMessageVisibilityRequestTest.php @@ -18,14 +18,14 @@ public function testRequest(): void /** @see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ChangeMessageVisibility.html */ $expected = ' POST / HTTP/1.0 - Content-Type: application/x-www-form-urlencoded + Content-Type: application/x-amz-json-1.0 + x-amz-target: AmazonSQS.ChangeMessageVisibility - Action=ChangeMessageVisibility - &Version=2012-11-05 - &QueueUrl=queueUrl - &ReceiptHandle=MbZj6wDWli%2BJvwwJaBV%2B3dcjk2YW2vA3%2BSTFFljT - &VisibilityTimeout=60 - '; + { + "QueueUrl": "queueUrl", + "ReceiptHandle": "MbZj6wDWli+JvwwJaBV+3dcjk2YW2vA3+STFFljT", + "VisibilityTimeout": 60 + }'; self::assertRequestEqualsHttpRequest($expected, $input->request()); } diff --git a/src/Service/Sqs/tests/Unit/Input/CreateQueueRequestTest.php b/src/Service/Sqs/tests/Unit/Input/CreateQueueRequestTest.php index a29378c2c..7ecc2b573 100644 --- a/src/Service/Sqs/tests/Unit/Input/CreateQueueRequestTest.php +++ b/src/Service/Sqs/tests/Unit/Input/CreateQueueRequestTest.php @@ -18,16 +18,18 @@ public function testRequest(): void /** @see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_CreateQueue.html */ $expected = ' POST / HTTP/1.0 - Content-Type: application/x-www-form-urlencoded + Content-Type: application/x-amz-json-1.0 + x-amz-target: AmazonSQS.CreateQueue - Action=CreateQueue - &Version=2012-11-05 - &QueueName=MyQueue - &Attribute.1.Name=DelaySeconds - &Attribute.1.Value=45 - &Tag.1.Key=team - &Tag.1.Value=Engineering - '; + { + "QueueName":"MyQueue", + "Attributes": { + "DelaySeconds": "45" + }, + "tags": { + "team": "Engineering" + } + }'; self::assertRequestEqualsHttpRequest($expected, $input->request()); } diff --git a/src/Service/Sqs/tests/Unit/Input/DeleteMessageBatchRequestTest.php b/src/Service/Sqs/tests/Unit/Input/DeleteMessageBatchRequestTest.php index 1718b2405..10a28cc7e 100644 --- a/src/Service/Sqs/tests/Unit/Input/DeleteMessageBatchRequestTest.php +++ b/src/Service/Sqs/tests/Unit/Input/DeleteMessageBatchRequestTest.php @@ -21,14 +21,18 @@ public function testRequest(): void /** @see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_DeleteMessageBatch.html */ $expected = ' POST / HTTP/1.0 - Content-Type: application/x-www-form-urlencoded + Content-Type: application/x-amz-json-1.0 + x-amz-target: AmazonSQS.DeleteMessageBatch - Action=DeleteMessageBatch - &DeleteMessageBatchRequestEntry.1.Id=qwertyuiop - &DeleteMessageBatchRequestEntry.1.ReceiptHandle=MbZj6wDWli%2BJvwwJaBV%2B3dcjk2YW2vA3%2BSTFFljT - &QueueUrl=queueUrl - &Version=2012-11-05 - '; + { + "QueueUrl": "queueUrl", + "Entries": [ + { + "Id": "qwertyuiop", + "ReceiptHandle": "MbZj6wDWli+JvwwJaBV+3dcjk2YW2vA3+STFFljT" + } + ] + }'; self::assertRequestEqualsHttpRequest($expected, $input->request()); } diff --git a/src/Service/Sqs/tests/Unit/Input/DeleteMessageRequestTest.php b/src/Service/Sqs/tests/Unit/Input/DeleteMessageRequestTest.php index e24ba0881..5c6a265de 100644 --- a/src/Service/Sqs/tests/Unit/Input/DeleteMessageRequestTest.php +++ b/src/Service/Sqs/tests/Unit/Input/DeleteMessageRequestTest.php @@ -17,13 +17,13 @@ public function testRequest(): void /** @see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_DeleteMessage.html */ $expected = ' POST / HTTP/1.0 - Content-Type: application/x-www-form-urlencoded + Content-Type: application/x-amz-json-1.0 + x-amz-target: AmazonSQS.DeleteMessage - Action=DeleteMessage - &Version=2012-11-05 - &QueueUrl=queueUrl - &ReceiptHandle=MbZj6wDWli%2BJvwwJaBV%2B3dcjk2YW2vA3%2BSTFFljT - '; + { + "QueueUrl": "queueUrl", + "ReceiptHandle": "MbZj6wDWli+JvwwJaBV+3dcjk2YW2vA3+STFFljT" + }'; self::assertRequestEqualsHttpRequest($expected, $input->request()); } diff --git a/src/Service/Sqs/tests/Unit/Input/DeleteQueueRequestTest.php b/src/Service/Sqs/tests/Unit/Input/DeleteQueueRequestTest.php index e70622f2d..bba85e4cd 100644 --- a/src/Service/Sqs/tests/Unit/Input/DeleteQueueRequestTest.php +++ b/src/Service/Sqs/tests/Unit/Input/DeleteQueueRequestTest.php @@ -16,12 +16,12 @@ public function testRequest(): void /** @see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_DeleteQueue.html */ $expected = ' POST / HTTP/1.0 - Content-Type: application/x-www-form-urlencoded + Content-Type: application/x-amz-json-1.0 + x-amz-target: AmazonSQS.DeleteQueue - Action=DeleteQueue - &Version=2012-11-05 - &QueueUrl=queueUrl - '; + { + "QueueUrl":"queueUrl" + }'; self::assertRequestEqualsHttpRequest($expected, $input->request()); } diff --git a/src/Service/Sqs/tests/Unit/Input/GetQueueAttributesRequestTest.php b/src/Service/Sqs/tests/Unit/Input/GetQueueAttributesRequestTest.php index 9b17bd9c3..97f735a50 100644 --- a/src/Service/Sqs/tests/Unit/Input/GetQueueAttributesRequestTest.php +++ b/src/Service/Sqs/tests/Unit/Input/GetQueueAttributesRequestTest.php @@ -17,15 +17,13 @@ public function testRequest(): void /** @see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_GetQueueAttributes.html */ $expected = ' POST / HTTP/1.0 - Content-Type: application/x-www-form-urlencoded + Content-Type: application/x-amz-json-1.0 + x-amz-target: AmazonSQS.GetQueueAttributes - Action=GetQueueAttributes - &Version=2012-11-05 - &QueueUrl=queueUrl - &AttributeName.1=VisibilityTimeout - &AttributeName.2=DelaySeconds - &AttributeName.3=ReceiveMessageWaitTimeSeconds - '; + { + "QueueUrl": "queueUrl", + "AttributeNames": ["VisibilityTimeout", "DelaySeconds", "ReceiveMessageWaitTimeSeconds"] + }'; self::assertRequestEqualsHttpRequest($expected, $input->request()); } diff --git a/src/Service/Sqs/tests/Unit/Input/GetQueueUrlRequestTest.php b/src/Service/Sqs/tests/Unit/Input/GetQueueUrlRequestTest.php index 0f0ea624a..b1bcd07d7 100644 --- a/src/Service/Sqs/tests/Unit/Input/GetQueueUrlRequestTest.php +++ b/src/Service/Sqs/tests/Unit/Input/GetQueueUrlRequestTest.php @@ -17,13 +17,13 @@ public function testRequest(): void /** @see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_GetQueueUrl.html */ $expected = ' POST / HTTP/1.0 - Content-Type: application/x-www-form-urlencoded + Content-Type: application/x-amz-json-1.0 + x-amz-target: AmazonSQS.GetQueueUrl - Action=GetQueueUrl - &Version=2012-11-05 - &QueueName=MyQueue - &QueueOwnerAWSAccountId=123456 - '; + { + "QueueName": "MyQueue", + "QueueOwnerAWSAccountId": "123456" + }'; self::assertRequestEqualsHttpRequest($expected, $input->request()); } diff --git a/src/Service/Sqs/tests/Unit/Input/ListQueuesRequestTest.php b/src/Service/Sqs/tests/Unit/Input/ListQueuesRequestTest.php index fb590cd4e..32e85037e 100644 --- a/src/Service/Sqs/tests/Unit/Input/ListQueuesRequestTest.php +++ b/src/Service/Sqs/tests/Unit/Input/ListQueuesRequestTest.php @@ -16,12 +16,12 @@ public function testRequest(): void /** @see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ListQueues.html */ $expected = ' POST / HTTP/1.0 - Content-Type: application/x-www-form-urlencoded + Content-Type: application/x-amz-json-1.0 + x-amz-target: AmazonSQS.ListQueues - Action=ListQueues - &Version=2012-11-05 - &QueueNamePrefix=M - '; + { + "QueueNamePrefix": "M" + }'; self::assertRequestEqualsHttpRequest($expected, $input->request()); } diff --git a/src/Service/Sqs/tests/Unit/Input/PurgeQueueRequestTest.php b/src/Service/Sqs/tests/Unit/Input/PurgeQueueRequestTest.php index f782c52a6..806b57f61 100644 --- a/src/Service/Sqs/tests/Unit/Input/PurgeQueueRequestTest.php +++ b/src/Service/Sqs/tests/Unit/Input/PurgeQueueRequestTest.php @@ -16,12 +16,12 @@ public function testRequest(): void /** @see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_PurgeQueue.html */ $expected = ' POST / HTTP/1.0 - Content-Type: application/x-www-form-urlencoded + Content-Type: application/x-amz-json-1.0 + x-amz-target: AmazonSQS.PurgeQueue - Action=PurgeQueue - &Version=2012-11-05 - &QueueUrl=queueUrl - '; + { + "QueueUrl": "queueUrl" + }'; self::assertRequestEqualsHttpRequest($expected, $input->request()); } diff --git a/src/Service/Sqs/tests/Unit/Input/ReceiveMessageRequestTest.php b/src/Service/Sqs/tests/Unit/Input/ReceiveMessageRequestTest.php index 735cfd465..46f6a0417 100644 --- a/src/Service/Sqs/tests/Unit/Input/ReceiveMessageRequestTest.php +++ b/src/Service/Sqs/tests/Unit/Input/ReceiveMessageRequestTest.php @@ -23,19 +23,18 @@ public function testRequest(): void /** @see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html */ $expected = ' POST / HTTP/1.0 - Content-Type: application/x-www-form-urlencoded + Content-Type: application/x-amz-json-1.0 + x-amz-target: AmazonSQS.ReceiveMessage - Action=ReceiveMessage - &Version=2012-11-05 - &QueueUrl=queueUrl - &AttributeName.1=MessageGroupId - &AttributeName.2=MessageDeduplicationId - &MessageAttributeName.1=Attribute1 - &MaxNumberOfMessages=5 - &VisibilityTimeout=15 - &WaitTimeSeconds=20 - &ReceiveRequestAttemptId=abcdef - '; + { + "QueueUrl": "queueUrl", + "AttributeNames": ["MessageGroupId", "MessageDeduplicationId"], + "MessageAttributeNames": ["Attribute1"], + "MaxNumberOfMessages": 5, + "VisibilityTimeout": 15, + "WaitTimeSeconds": 20, + "ReceiveRequestAttemptId": "abcdef" + }'; self::assertRequestEqualsHttpRequest($expected, $input->request()); } diff --git a/src/Service/Sqs/tests/Unit/Input/SendMessageBatchRequestTest.php b/src/Service/Sqs/tests/Unit/Input/SendMessageBatchRequestTest.php index b1b00cd55..8260f9abb 100644 --- a/src/Service/Sqs/tests/Unit/Input/SendMessageBatchRequestTest.php +++ b/src/Service/Sqs/tests/Unit/Input/SendMessageBatchRequestTest.php @@ -29,20 +29,27 @@ public function testRequest(): void /** @see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SendMessageBatch.html */ $expected = ' POST / HTTP/1.0 - Content-Type: application/x-www-form-urlencoded + Content-Type: application/x-amz-json-1.0 + x-amz-target: AmazonSQS.SendMessageBatch - Action=SendMessageBatch - &QueueUrl=queueUrl - &SendMessageBatchRequestEntry.1.Id=qwertyuiop - &SendMessageBatchRequestEntry.1.DelaySeconds=45 - &SendMessageBatchRequestEntry.1.MessageAttribute.1.Value.DataType=String - &SendMessageBatchRequestEntry.1.MessageAttribute.1.Value.StringValue=my_attribute_value_1 - &SendMessageBatchRequestEntry.1.MessageAttribute.1.Name=my_attribute_name_1 - &SendMessageBatchRequestEntry.1.MessageBody=This+is+a+test+message - &SendMessageBatchRequestEntry.1.MessageDeduplicationId=abcdef - &SendMessageBatchRequestEntry.1.MessageGroupId=abcdef01 - &Version=2012-11-05 - '; + { + "QueueUrl": "queueUrl", + "Entries": [ + { + "Id": "qwertyuiop", + "MessageBody": "This is a test message", + "DelaySeconds": 45, + "MessageAttributes": { + "my_attribute_name_1": { + "DataType": "String", + "StringValue": "my_attribute_value_1" + } + }, + "MessageDeduplicationId": "abcdef", + "MessageGroupId": "abcdef01" + } + ] + }'; self::assertRequestEqualsHttpRequest($expected, $input->request()); } diff --git a/src/Service/Sqs/tests/Unit/Input/SendMessageRequestTest.php b/src/Service/Sqs/tests/Unit/Input/SendMessageRequestTest.php index 45612a211..32985cb8a 100644 --- a/src/Service/Sqs/tests/Unit/Input/SendMessageRequestTest.php +++ b/src/Service/Sqs/tests/Unit/Input/SendMessageRequestTest.php @@ -31,23 +31,28 @@ public function testRequest(): void /** @see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SendMessage.html */ $expected = ' POST / HTTP/1.0 - Content-Type: application/x-www-form-urlencoded + Content-Type: application/x-amz-json-1.0 + x-amz-target: AmazonSQS.SendMessage - Action=SendMessage - &Version=2012-11-05 - &QueueUrl=queueUrl - &MessageBody=This+is+a+test+message - &DelaySeconds=45 - &MessageAttribute.1.Name=my_attribute_name_1 - &MessageAttribute.1.Value.StringValue=my_attribute_value_1 - &MessageAttribute.1.Value.DataType=String - &MessageSystemAttribute.1.Name=AWSTraceHeader - &MessageSystemAttribute.1.Value.StringListValue.1=my_attribute_value_2 - &MessageSystemAttribute.1.Value.StringListValue.2=my_attribute_value_3 - &MessageSystemAttribute.1.Value.DataType=String - &MessageDeduplicationId=abcdef - &MessageGroupId=abcdef01 - '; + { + "QueueUrl": "queueUrl", + "MessageBody": "This is a test message", + "DelaySeconds": 45, + "MessageAttributes": { + "my_attribute_name_1": { + "DataType": "String", + "StringValue": "my_attribute_value_1" + } + }, + "MessageSystemAttributes": { + "AWSTraceHeader": { + "DataType": "String", + "StringListValues": ["my_attribute_value_2", "my_attribute_value_3"] + } + }, + "MessageDeduplicationId": "abcdef", + "MessageGroupId": "abcdef01" + }'; self::assertRequestEqualsHttpRequest($expected, $input->request()); } diff --git a/src/Service/Sqs/tests/Unit/Result/ChangeMessageVisibilityBatchResultTest.php b/src/Service/Sqs/tests/Unit/Result/ChangeMessageVisibilityBatchResultTest.php index cc96fc447..77fbdfb30 100644 --- a/src/Service/Sqs/tests/Unit/Result/ChangeMessageVisibilityBatchResultTest.php +++ b/src/Service/Sqs/tests/Unit/Result/ChangeMessageVisibilityBatchResultTest.php @@ -14,21 +14,19 @@ class ChangeMessageVisibilityBatchResultTest extends TestCase public function testChangeMessageVisibilityBatchResult(): void { // see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ChangeMessageVisibilityBatch.html - $response = new SimpleMockedResponse(<< - - - change_visibility_msg_2 - - - change_visibility_msg_3 - - - - ca9668f7-ab1b-4f7a-8859-f15747ab17a7 - - -XML + $response = new SimpleMockedResponse(<< - - - https://queue.amazonaws.com/123456789012/MyQueue - - - 7a62c49f-347e-4fc4-9331-6e8e7a96aa73 - - -XML + // see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_CreateQueue.html + $response = new SimpleMockedResponse(<< - - - msg1 - - - msg2 - - - - d6f86b7a-74d1-4439-b43f-196a1e29cd85 - - -XML + $response = new SimpleMockedResponse(<< - - - ReceiveMessageWaitTimeSeconds - 2 - - - VisibilityTimeout - 30 - - - ApproximateNumberOfMessages - 0 - - - ApproximateNumberOfMessagesNotVisible - 0 - - - CreatedTimestamp - 1286771522 - - - LastModifiedTimestamp - 1286771522 - - - QueueArn - arn:aws:sqs:us-east-2:123456789012:MyQueue - - - MaximumMessageSize - 8192 - - - MessageRetentionPeriod - 345600 - - - - 1ea71be5-b5a2-4f9d-b85a-945d8d08cd0b - - -XML + // see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_GetQueueAttributes.html + $response = new SimpleMockedResponse(<< - - https://sqs.us-east-2.amazonaws.com/123456789012/MyQueue - - - 470a6f13-2ed9-4181-ad8a-2fdea142988e - - -XML + // see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_GetQueueUrl.html + $response = new SimpleMockedResponse(<< - - https://sqs.us-east-2.amazonaws.com/123456789012/MyQueue - - - 725275ae-0b9b-4762-b238-436d7c65a1ac - - -XML + // see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ListQueues.html + $response = new SimpleMockedResponse(<< - - - 5fea7756-0ea4-451a-a703-a558b933e274 - - MbZj6wDWli+JvwwJaBV+3dcjk2YW2vA3+STFFljTM8tJJg6HRG6PYSasuWXPJB+Cw - Lj1FjgXUv1uSj1gUPAWV66FU/WeR4mq2OKpEGYWbnLmpRCJVAyeMjeU5ZBdtcQ+QE - auMZc8ZRv37sIW2iJKq3M9MFx1YvV11A2x/KSbkJ0= - - fafb00f5732ab283681e124bf8747ed1 - This is a test message - - SenderId - 195004372649 - - - SentTimestamp - 1238099229000 - - - ApproximateReceiveCount - 5 - - - ApproximateFirstReceiveTimestamp - 1250700979248 - - - - - b6633655-283d-45b4-aee4-4e84e0ae6afa - - -XML + // see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html + $response = new SimpleMockedResponse(<< - - - test_msg_001 - 0a5231c7-8bff-4955-be2e-8dc7c50a25fa - 0e024d309850c78cba5eabbeff7cae71 - - - test_msg_002 - 15ee1ed3-87e7-40c1-bdaa-2e49968ea7e9 - 7fb8146a82f95e0af155278f406862c2 - 295c5fa15a51aae6884d1d7c1d99ca50 - - - - ca1ad5d0-8271-408b-8d0f-1351bf547e74 - - -XML + $response = new SimpleMockedResponse(<< - - fafb00f5732ab283681e124bf8747ed1 - 3ae8f24a165a8cedc005670c81a27295 - 5fea7756-0ea4-451a-a703-a558b933e274 - - - 27daac76-34dd-47df-bd01-1f6e873584a0 - - -XML + // see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SendMessage.html + $response = new SimpleMockedResponse(<< 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