1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-06 03:50:04 +02:00

Update Composer dependencies.

This commit is contained in:
Caleb Mazalevskis 2023-02-15 23:36:22 +08:00
parent 12049cba3a
commit 47fbfd2bca
No known key found for this signature in database
GPG key ID: 082E6BC1046FAB95
12558 changed files with 155183 additions and 28099 deletions

242
composer.lock generated
View file

@ -277,16 +277,16 @@
}, },
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
"version": "3.258.3", "version": "3.258.10",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/aws/aws-sdk-php.git", "url": "https://github.com/aws/aws-sdk-php.git",
"reference": "57cbc06827148d0d4d3f5dbe4b948daa20f82d70" "reference": "e164c9c5faf3965bd27ff2a4e9b7b3048ba8a337"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/57cbc06827148d0d4d3f5dbe4b948daa20f82d70", "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/e164c9c5faf3965bd27ff2a4e9b7b3048ba8a337",
"reference": "57cbc06827148d0d4d3f5dbe4b948daa20f82d70", "reference": "e164c9c5faf3965bd27ff2a4e9b7b3048ba8a337",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -365,9 +365,9 @@
"support": { "support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues", "issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.258.3" "source": "https://github.com/aws/aws-sdk-php/tree/3.258.10"
}, },
"time": "2023-02-03T19:25:20+00:00" "time": "2023-02-14T19:21:16+00:00"
}, },
{ {
"name": "brick/math", "name": "brick/math",
@ -541,16 +541,16 @@
}, },
{ {
"name": "composer/ca-bundle", "name": "composer/ca-bundle",
"version": "1.3.3", "version": "1.3.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/ca-bundle.git", "url": "https://github.com/composer/ca-bundle.git",
"reference": "30897edbfb15e784fe55587b4f73ceefd3c4d98c" "reference": "74780ccf8c19d6acb8d65c5f39cd72110e132bbd"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/30897edbfb15e784fe55587b4f73ceefd3c4d98c", "url": "https://api.github.com/repos/composer/ca-bundle/zipball/74780ccf8c19d6acb8d65c5f39cd72110e132bbd",
"reference": "30897edbfb15e784fe55587b4f73ceefd3c4d98c", "reference": "74780ccf8c19d6acb8d65c5f39cd72110e132bbd",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -597,7 +597,7 @@
"support": { "support": {
"irc": "irc://irc.freenode.org/composer", "irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/ca-bundle/issues", "issues": "https://github.com/composer/ca-bundle/issues",
"source": "https://github.com/composer/ca-bundle/tree/1.3.3" "source": "https://github.com/composer/ca-bundle/tree/1.3.5"
}, },
"funding": [ "funding": [
{ {
@ -613,7 +613,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-07-20T07:14:26+00:00" "time": "2023-01-11T08:27:00+00:00"
}, },
{ {
"name": "emojione/assets", "name": "emojione/assets",
@ -813,16 +813,16 @@
}, },
{ {
"name": "firebase/php-jwt", "name": "firebase/php-jwt",
"version": "v6.3.2", "version": "v6.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/firebase/php-jwt.git", "url": "https://github.com/firebase/php-jwt.git",
"reference": "ea7dda77098b96e666c5ef382452f94841e439cd" "reference": "4dd1e007f22a927ac77da5a3fbb067b42d3bc224"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/ea7dda77098b96e666c5ef382452f94841e439cd", "url": "https://api.github.com/repos/firebase/php-jwt/zipball/4dd1e007f22a927ac77da5a3fbb067b42d3bc224",
"reference": "ea7dda77098b96e666c5ef382452f94841e439cd", "reference": "4dd1e007f22a927ac77da5a3fbb067b42d3bc224",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -837,6 +837,7 @@
"psr/http-factory": "^1.0" "psr/http-factory": "^1.0"
}, },
"suggest": { "suggest": {
"ext-sodium": "Support EdDSA (Ed25519) signatures",
"paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present"
}, },
"type": "library", "type": "library",
@ -869,9 +870,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/firebase/php-jwt/issues", "issues": "https://github.com/firebase/php-jwt/issues",
"source": "https://github.com/firebase/php-jwt/tree/v6.3.2" "source": "https://github.com/firebase/php-jwt/tree/v6.4.0"
}, },
"time": "2022-12-19T17:10:46+00:00" "time": "2023-02-09T21:01:23+00:00"
}, },
{ {
"name": "gliterd/backblaze-b2", "name": "gliterd/backblaze-b2",
@ -1776,16 +1777,16 @@
}, },
{ {
"name": "nesbot/carbon", "name": "nesbot/carbon",
"version": "2.62.1", "version": "2.66.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/briannesbitt/Carbon.git", "url": "https://github.com/briannesbitt/Carbon.git",
"reference": "01bc4cdefe98ef58d1f9cb31bdbbddddf2a88f7a" "reference": "496712849902241f04902033b0441b269effe001"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/01bc4cdefe98ef58d1f9cb31bdbbddddf2a88f7a", "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/496712849902241f04902033b0441b269effe001",
"reference": "01bc4cdefe98ef58d1f9cb31bdbbddddf2a88f7a", "reference": "496712849902241f04902033b0441b269effe001",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1796,7 +1797,7 @@
"symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0" "symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0"
}, },
"require-dev": { "require-dev": {
"doctrine/dbal": "^2.0 || ^3.0", "doctrine/dbal": "^2.0 || ^3.1.4",
"doctrine/orm": "^2.7", "doctrine/orm": "^2.7",
"friendsofphp/php-cs-fixer": "^3.0", "friendsofphp/php-cs-fixer": "^3.0",
"kylekatarnls/multi-tester": "^2.0", "kylekatarnls/multi-tester": "^2.0",
@ -1874,7 +1875,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-09-02T07:48:13+00:00" "time": "2023-01-29T18:53:47+00:00"
}, },
{ {
"name": "norkunas/onesignal-php-api", "name": "norkunas/onesignal-php-api",
@ -2188,6 +2189,7 @@
"support": { "support": {
"source": "https://github.com/paypal/Checkout-PHP-SDK/tree/1.0.2" "source": "https://github.com/paypal/Checkout-PHP-SDK/tree/1.0.2"
}, },
"abandoned": true,
"time": "2021-09-21T20:57:38+00:00" "time": "2021-09-21T20:57:38+00:00"
}, },
{ {
@ -2584,16 +2586,16 @@
}, },
{ {
"name": "predis/predis", "name": "predis/predis",
"version": "v2.0.3", "version": "v2.1.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/predis/predis.git", "url": "https://github.com/predis/predis.git",
"reference": "ff59f745815150c65ed388f7d64e7660fe961771" "reference": "c5b60884e89630f9518a7919f0566db438f0fc9a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/predis/predis/zipball/ff59f745815150c65ed388f7d64e7660fe961771", "url": "https://api.github.com/repos/predis/predis/zipball/c5b60884e89630f9518a7919f0566db438f0fc9a",
"reference": "ff59f745815150c65ed388f7d64e7660fe961771", "reference": "c5b60884e89630f9518a7919f0566db438f0fc9a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2603,8 +2605,7 @@
"phpunit/phpunit": "^8.0 || ~9.4.4" "phpunit/phpunit": "^8.0 || ~9.4.4"
}, },
"suggest": { "suggest": {
"ext-curl": "Allows access to Webdis when paired with phpiredis", "ext-curl": "Allows access to Webdis when paired with phpiredis"
"ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@ -2622,16 +2623,16 @@
"MIT" "MIT"
], ],
"authors": [ "authors": [
{
"name": "Daniele Alessandri",
"email": "suppakilla@gmail.com",
"homepage": "http://clorophilla.net",
"role": "Creator & Maintainer"
},
{ {
"name": "Till Krüss", "name": "Till Krüss",
"homepage": "https://till.im", "homepage": "https://till.im",
"role": "Maintainer" "role": "Maintainer"
},
{
"name": "Daniele Alessandri",
"email": "suppakilla@gmail.com",
"homepage": "http://clorophilla.net",
"role": "Creator"
} }
], ],
"description": "A flexible and feature-complete Redis client for PHP.", "description": "A flexible and feature-complete Redis client for PHP.",
@ -2643,7 +2644,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/predis/predis/issues", "issues": "https://github.com/predis/predis/issues",
"source": "https://github.com/predis/predis/tree/v2.0.3" "source": "https://github.com/predis/predis/tree/v2.1.1"
}, },
"funding": [ "funding": [
{ {
@ -2651,7 +2652,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2022-10-11T16:52:29+00:00" "time": "2023-01-17T20:57:35+00:00"
}, },
{ {
"name": "psr/cache", "name": "psr/cache",
@ -3344,16 +3345,16 @@
}, },
{ {
"name": "react/cache", "name": "react/cache",
"version": "v1.1.1", "version": "v1.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/reactphp/cache.git", "url": "https://github.com/reactphp/cache.git",
"reference": "4bf736a2cccec7298bdf745db77585966fc2ca7e" "reference": "d47c472b64aa5608225f47965a484b75c7817d5b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/reactphp/cache/zipball/4bf736a2cccec7298bdf745db77585966fc2ca7e", "url": "https://api.github.com/repos/reactphp/cache/zipball/d47c472b64aa5608225f47965a484b75c7817d5b",
"reference": "4bf736a2cccec7298bdf745db77585966fc2ca7e", "reference": "d47c472b64aa5608225f47965a484b75c7817d5b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3361,7 +3362,7 @@
"react/promise": "^3.0 || ^2.0 || ^1.1" "react/promise": "^3.0 || ^2.0 || ^1.1"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -3404,32 +3405,28 @@
], ],
"support": { "support": {
"issues": "https://github.com/reactphp/cache/issues", "issues": "https://github.com/reactphp/cache/issues",
"source": "https://github.com/reactphp/cache/tree/v1.1.1" "source": "https://github.com/reactphp/cache/tree/v1.2.0"
}, },
"funding": [ "funding": [
{ {
"url": "https://github.com/WyriHaximus", "url": "https://opencollective.com/reactphp",
"type": "github" "type": "open_collective"
},
{
"url": "https://github.com/clue",
"type": "github"
} }
], ],
"time": "2021-02-02T06:47:52+00:00" "time": "2022-11-30T15:59:55+00:00"
}, },
{ {
"name": "react/dns", "name": "react/dns",
"version": "v1.9.0", "version": "v1.10.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/reactphp/dns.git", "url": "https://github.com/reactphp/dns.git",
"reference": "6d38296756fa644e6cb1bfe95eff0f9a4ed6edcb" "reference": "a5427e7dfa47713e438016905605819d101f238c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/reactphp/dns/zipball/6d38296756fa644e6cb1bfe95eff0f9a4ed6edcb", "url": "https://api.github.com/repos/reactphp/dns/zipball/a5427e7dfa47713e438016905605819d101f238c",
"reference": "6d38296756fa644e6cb1bfe95eff0f9a4ed6edcb", "reference": "a5427e7dfa47713e438016905605819d101f238c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3437,11 +3434,11 @@
"react/cache": "^1.0 || ^0.6 || ^0.5", "react/cache": "^1.0 || ^0.6 || ^0.5",
"react/event-loop": "^1.2", "react/event-loop": "^1.2",
"react/promise": "^3.0 || ^2.7 || ^1.2.1", "react/promise": "^3.0 || ^2.7 || ^1.2.1",
"react/promise-timer": "^1.8" "react/promise-timer": "^1.9"
}, },
"require-dev": { "require-dev": {
"clue/block-react": "^1.2", "phpunit/phpunit": "^9.3 || ^4.8.35",
"phpunit/phpunit": "^9.3 || ^4.8.35" "react/async": "^4 || ^3 || ^2"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -3484,7 +3481,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/reactphp/dns/issues", "issues": "https://github.com/reactphp/dns/issues",
"source": "https://github.com/reactphp/dns/tree/v1.9.0" "source": "https://github.com/reactphp/dns/tree/v1.10.0"
}, },
"funding": [ "funding": [
{ {
@ -3496,7 +3493,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2021-12-20T08:46:54+00:00" "time": "2022-09-08T12:22:46+00:00"
}, },
{ {
"name": "react/event-loop", "name": "react/event-loop",
@ -3737,16 +3734,16 @@
}, },
{ {
"name": "react/socket", "name": "react/socket",
"version": "v1.11.0", "version": "v1.12.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/reactphp/socket.git", "url": "https://github.com/reactphp/socket.git",
"reference": "f474156aaab4f09041144fa8b57c7d70aed32a1c" "reference": "81e1b4d7f5450ebd8d2e9a95bb008bb15ca95a7b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/reactphp/socket/zipball/f474156aaab4f09041144fa8b57c7d70aed32a1c", "url": "https://api.github.com/repos/reactphp/socket/zipball/81e1b4d7f5450ebd8d2e9a95bb008bb15ca95a7b",
"reference": "f474156aaab4f09041144fa8b57c7d70aed32a1c", "reference": "81e1b4d7f5450ebd8d2e9a95bb008bb15ca95a7b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3754,14 +3751,14 @@
"php": ">=5.3.0", "php": ">=5.3.0",
"react/dns": "^1.8", "react/dns": "^1.8",
"react/event-loop": "^1.2", "react/event-loop": "^1.2",
"react/promise": "^2.6.0 || ^1.2.1", "react/promise": "^3 || ^2.6 || ^1.2.1",
"react/promise-timer": "^1.8", "react/promise-timer": "^1.9",
"react/stream": "^1.2" "react/stream": "^1.2"
}, },
"require-dev": { "require-dev": {
"clue/block-react": "^1.5",
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35", "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35",
"react/promise-stream": "^1.2" "react/async": "^4 || ^3 || ^2",
"react/promise-stream": "^1.4"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -3805,7 +3802,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/reactphp/socket/issues", "issues": "https://github.com/reactphp/socket/issues",
"source": "https://github.com/reactphp/socket/tree/v1.11.0" "source": "https://github.com/reactphp/socket/tree/v1.12.0"
}, },
"funding": [ "funding": [
{ {
@ -3817,7 +3814,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2022-01-14T10:14:32+00:00" "time": "2022-08-25T12:32:25+00:00"
}, },
{ {
"name": "react/stream", "name": "react/stream",
@ -4049,16 +4046,16 @@
}, },
{ {
"name": "stripe/stripe-php", "name": "stripe/stripe-php",
"version": "v10.4.0", "version": "v10.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/stripe/stripe-php.git", "url": "https://github.com/stripe/stripe-php.git",
"reference": "87def896d9a2e2914871408277d67432cb112f71" "reference": "331415b232d60d7c0449de7bde4cb7d4fedf982e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/87def896d9a2e2914871408277d67432cb112f71", "url": "https://api.github.com/repos/stripe/stripe-php/zipball/331415b232d60d7c0449de7bde4cb7d4fedf982e",
"reference": "87def896d9a2e2914871408277d67432cb112f71", "reference": "331415b232d60d7c0449de7bde4cb7d4fedf982e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4104,22 +4101,22 @@
], ],
"support": { "support": {
"issues": "https://github.com/stripe/stripe-php/issues", "issues": "https://github.com/stripe/stripe-php/issues",
"source": "https://github.com/stripe/stripe-php/tree/v10.4.0" "source": "https://github.com/stripe/stripe-php/tree/v10.5.0"
}, },
"time": "2023-01-19T19:18:38+00:00" "time": "2023-02-02T21:02:09+00:00"
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v5.4.15", "version": "v5.4.19",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "ea59bb0edfaf9f28d18d8791410ee0355f317669" "reference": "dccb8d251a9017d5994c988b034d3e18aaabf740"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/ea59bb0edfaf9f28d18d8791410ee0355f317669", "url": "https://api.github.com/repos/symfony/console/zipball/dccb8d251a9017d5994c988b034d3e18aaabf740",
"reference": "ea59bb0edfaf9f28d18d8791410ee0355f317669", "reference": "dccb8d251a9017d5994c988b034d3e18aaabf740",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4189,7 +4186,7 @@
"terminal" "terminal"
], ],
"support": { "support": {
"source": "https://github.com/symfony/console/tree/v5.4.15" "source": "https://github.com/symfony/console/tree/v5.4.19"
}, },
"funding": [ "funding": [
{ {
@ -4205,7 +4202,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-10-26T21:41:52+00:00" "time": "2023-01-01T08:32:19+00:00"
}, },
{ {
"name": "symfony/deprecation-contracts", "name": "symfony/deprecation-contracts",
@ -4276,16 +4273,16 @@
}, },
{ {
"name": "symfony/event-dispatcher", "name": "symfony/event-dispatcher",
"version": "v5.4.9", "version": "v5.4.19",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/event-dispatcher.git", "url": "https://github.com/symfony/event-dispatcher.git",
"reference": "8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc" "reference": "abf49cc084c087d94b4cb939c3f3672971784e0c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc", "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/abf49cc084c087d94b4cb939c3f3672971784e0c",
"reference": "8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc", "reference": "abf49cc084c087d94b4cb939c3f3672971784e0c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4341,7 +4338,7 @@
"description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/event-dispatcher/tree/v5.4.9" "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.19"
}, },
"funding": [ "funding": [
{ {
@ -4357,7 +4354,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-05-05T16:45:39+00:00" "time": "2023-01-01T08:32:19+00:00"
}, },
{ {
"name": "symfony/event-dispatcher-contracts", "name": "symfony/event-dispatcher-contracts",
@ -4605,16 +4602,16 @@
}, },
{ {
"name": "symfony/http-foundation", "name": "symfony/http-foundation",
"version": "v5.4.10", "version": "v5.4.20",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/http-foundation.git", "url": "https://github.com/symfony/http-foundation.git",
"reference": "e7793b7906f72a8cc51054fbca9dcff7a8af1c1e" "reference": "d0435363362a47c14e9cf50663cb8ffbf491875a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/e7793b7906f72a8cc51054fbca9dcff7a8af1c1e", "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d0435363362a47c14e9cf50663cb8ffbf491875a",
"reference": "e7793b7906f72a8cc51054fbca9dcff7a8af1c1e", "reference": "d0435363362a47c14e9cf50663cb8ffbf491875a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4626,8 +4623,11 @@
"require-dev": { "require-dev": {
"predis/predis": "~1.0", "predis/predis": "~1.0",
"symfony/cache": "^4.4|^5.0|^6.0", "symfony/cache": "^4.4|^5.0|^6.0",
"symfony/dependency-injection": "^5.4|^6.0",
"symfony/expression-language": "^4.4|^5.0|^6.0", "symfony/expression-language": "^4.4|^5.0|^6.0",
"symfony/mime": "^4.4|^5.0|^6.0" "symfony/http-kernel": "^5.4.12|^6.0.12|^6.1.4",
"symfony/mime": "^4.4|^5.0|^6.0",
"symfony/rate-limiter": "^5.2|^6.0"
}, },
"suggest": { "suggest": {
"symfony/mime": "To use the file extension guesser" "symfony/mime": "To use the file extension guesser"
@ -4658,7 +4658,7 @@
"description": "Defines an object-oriented layer for the HTTP specification", "description": "Defines an object-oriented layer for the HTTP specification",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/http-foundation/tree/v5.4.10" "source": "https://github.com/symfony/http-foundation/tree/v5.4.20"
}, },
"funding": [ "funding": [
{ {
@ -4674,20 +4674,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-06-19T13:13:40+00:00" "time": "2023-01-29T11:11:52+00:00"
}, },
{ {
"name": "symfony/mime", "name": "symfony/mime",
"version": "v5.4.14", "version": "v5.4.19",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/mime.git", "url": "https://github.com/symfony/mime.git",
"reference": "1c118b253bb3495d81e95a6e3ec6c2766a98a0c4" "reference": "a858429a9c704edc53fe057228cf9ca282ba48eb"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/mime/zipball/1c118b253bb3495d81e95a6e3ec6c2766a98a0c4", "url": "https://api.github.com/repos/symfony/mime/zipball/a858429a9c704edc53fe057228cf9ca282ba48eb",
"reference": "1c118b253bb3495d81e95a6e3ec6c2766a98a0c4", "reference": "a858429a9c704edc53fe057228cf9ca282ba48eb",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4705,7 +4705,7 @@
"symfony/serializer": "<5.4.14|>=6.0,<6.0.14|>=6.1,<6.1.6" "symfony/serializer": "<5.4.14|>=6.0,<6.0.14|>=6.1,<6.1.6"
}, },
"require-dev": { "require-dev": {
"egulias/email-validator": "^2.1.10|^3.1", "egulias/email-validator": "^2.1.10|^3.1|^4",
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
"symfony/dependency-injection": "^4.4|^5.0|^6.0", "symfony/dependency-injection": "^4.4|^5.0|^6.0",
"symfony/property-access": "^4.4|^5.1|^6.0", "symfony/property-access": "^4.4|^5.1|^6.0",
@ -4742,7 +4742,7 @@
"mime-type" "mime-type"
], ],
"support": { "support": {
"source": "https://github.com/symfony/mime/tree/v5.4.14" "source": "https://github.com/symfony/mime/tree/v5.4.19"
}, },
"funding": [ "funding": [
{ {
@ -4758,20 +4758,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-10-07T08:01:20+00:00" "time": "2023-01-09T05:43:46+00:00"
}, },
{ {
"name": "symfony/options-resolver", "name": "symfony/options-resolver",
"version": "v5.4.11", "version": "v5.4.19",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/options-resolver.git", "url": "https://github.com/symfony/options-resolver.git",
"reference": "54f14e36aa73cb8f7261d7686691fd4d75ea2690" "reference": "b03c99236445492f20c61666e8f7e5d388b078e5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/54f14e36aa73cb8f7261d7686691fd4d75ea2690", "url": "https://api.github.com/repos/symfony/options-resolver/zipball/b03c99236445492f20c61666e8f7e5d388b078e5",
"reference": "54f14e36aa73cb8f7261d7686691fd4d75ea2690", "reference": "b03c99236445492f20c61666e8f7e5d388b078e5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4811,7 +4811,7 @@
"options" "options"
], ],
"support": { "support": {
"source": "https://github.com/symfony/options-resolver/tree/v5.4.11" "source": "https://github.com/symfony/options-resolver/tree/v5.4.19"
}, },
"funding": [ "funding": [
{ {
@ -4827,7 +4827,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-07-20T13:00:38+00:00" "time": "2023-01-01T08:32:19+00:00"
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",
@ -5565,16 +5565,16 @@
}, },
{ {
"name": "symfony/routing", "name": "symfony/routing",
"version": "v5.4.8", "version": "v5.4.19",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/routing.git", "url": "https://github.com/symfony/routing.git",
"reference": "e07817bb6244ea33ef5ad31abc4a9288bef3f2f7" "reference": "df1b28f37c8e78912213c58ef6ab2f2037bbfdc5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/routing/zipball/e07817bb6244ea33ef5ad31abc4a9288bef3f2f7", "url": "https://api.github.com/repos/symfony/routing/zipball/df1b28f37c8e78912213c58ef6ab2f2037bbfdc5",
"reference": "e07817bb6244ea33ef5ad31abc4a9288bef3f2f7", "reference": "df1b28f37c8e78912213c58ef6ab2f2037bbfdc5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -5589,7 +5589,7 @@
"symfony/yaml": "<4.4" "symfony/yaml": "<4.4"
}, },
"require-dev": { "require-dev": {
"doctrine/annotations": "^1.12", "doctrine/annotations": "^1.12|^2",
"psr/log": "^1|^2|^3", "psr/log": "^1|^2|^3",
"symfony/config": "^5.3|^6.0", "symfony/config": "^5.3|^6.0",
"symfony/dependency-injection": "^4.4|^5.0|^6.0", "symfony/dependency-injection": "^4.4|^5.0|^6.0",
@ -5635,7 +5635,7 @@
"url" "url"
], ],
"support": { "support": {
"source": "https://github.com/symfony/routing/tree/v5.4.8" "source": "https://github.com/symfony/routing/tree/v5.4.19"
}, },
"funding": [ "funding": [
{ {
@ -5651,7 +5651,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-04-18T21:45:37+00:00" "time": "2023-01-01T08:32:19+00:00"
}, },
{ {
"name": "symfony/service-contracts", "name": "symfony/service-contracts",
@ -5738,16 +5738,16 @@
}, },
{ {
"name": "symfony/string", "name": "symfony/string",
"version": "v5.4.15", "version": "v5.4.19",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/string.git", "url": "https://github.com/symfony/string.git",
"reference": "571334ce9f687e3e6af72db4d3b2a9431e4fd9ed" "reference": "0a01071610fd861cc160dfb7e2682ceec66064cb"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/571334ce9f687e3e6af72db4d3b2a9431e4fd9ed", "url": "https://api.github.com/repos/symfony/string/zipball/0a01071610fd861cc160dfb7e2682ceec66064cb",
"reference": "571334ce9f687e3e6af72db4d3b2a9431e4fd9ed", "reference": "0a01071610fd861cc160dfb7e2682ceec66064cb",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -5804,7 +5804,7 @@
"utf8" "utf8"
], ],
"support": { "support": {
"source": "https://github.com/symfony/string/tree/v5.4.15" "source": "https://github.com/symfony/string/tree/v5.4.19"
}, },
"funding": [ "funding": [
{ {
@ -5820,7 +5820,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-10-05T15:16:54+00:00" "time": "2023-01-01T08:32:19+00:00"
}, },
{ {
"name": "symfony/translation", "name": "symfony/translation",

17
vendor/autoload.php vendored
View file

@ -3,8 +3,21 @@
// autoload.php @generated by Composer // autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) { if (PHP_VERSION_ID < 50600) {
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; if (!headers_sent()) {
exit(1); header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
} }
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';

View file

@ -1,58 +1,58 @@
--- ---
Language: Cpp Language: Cpp
# BasedOnStyle: Mozilla # BasedOnStyle: Mozilla
AlignAfterOpenBracket: AlwaysBreak AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right AlignEscapedNewlines: Right
AlignOperands: true AlignOperands: true
AlignTrailingComments: true AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false AlwaysBreakBeforeMultilineStrings: false
BinPackArguments: false BinPackArguments: false
BinPackParameters: false BinPackParameters: false
BreakBeforeBinaryOperators: None BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true BreakBeforeTernaryOperators: true
BreakStringLiterals: true BreakStringLiterals: true
ColumnLimit: 120 ColumnLimit: 120
ContinuationIndentWidth: 4 ContinuationIndentWidth: 4
DerivePointerAlignment: false DerivePointerAlignment: false
IncludeBlocks: Preserve IncludeBlocks: Preserve
IndentCaseLabels: true IndentCaseLabels: true
IndentPPDirectives: AfterHash IndentPPDirectives: AfterHash
IndentWidth: 4 IndentWidth: 4
IndentWrappedFunctionNames: true IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: true KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: '' MacroBlockBegin: ''
MacroBlockEnd: '' MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1 MaxEmptyLinesToKeep: 1
PenaltyBreakAssignment: 2 PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19 PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300 PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120 PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000 PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000 PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 100000 PenaltyReturnTypeOnItsOwnLine: 100000
PointerAlignment: Right PointerAlignment: Right
ReflowComments: true ReflowComments: true
SortIncludes: true SortIncludes: true
SpaceAfterCStyleCast: false SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false SpaceInEmptyParentheses: false
SpacesInContainerLiterals: true SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false SpacesInCStyleCastParentheses: false
SpacesInParentheses: false SpacesInParentheses: false
SpacesInSquareBrackets: false SpacesInSquareBrackets: false
Standard: Cpp11 Standard: Cpp11
TabWidth: 4 TabWidth: 4
UseTab: Never UseTab: Never
... ...

View file

@ -1,4 +1,4 @@
# ignore generated files # ignore generated files
ext/api.h ext/api.h
ext/*_arginfo.h ext/*_arginfo.h
src/api.h src/api.h

View file

@ -1,36 +1,36 @@
--- ---
name: "\U0001F41B Bug report" name: "\U0001F41B Bug report"
about: Create a report to help us improve about: Create a report to help us improve
title: '' title: ''
labels: bug, needs-triage labels: bug, needs-triage
assignees: '' assignees: ''
--- ---
Confirm by changing [ ] to [x] below to ensure that it's a bug: Confirm by changing [ ] to [x] below to ensure that it's a bug:
- [ ] I've gone though [Developer Guide](https://docs.aws.amazon.com/sdk-for-cpp/v1/developer-guide/welcome.html) and [API reference](http://sdk.amazonaws.com/cpp/api/LATEST/index.html) - [ ] I've gone though [Developer Guide](https://docs.aws.amazon.com/sdk-for-cpp/v1/developer-guide/welcome.html) and [API reference](http://sdk.amazonaws.com/cpp/api/LATEST/index.html)
- [ ] I've searched for [previous similar issues](https://github.com/aws/aws-sdk-cpp/issues) and didn't find any solution - [ ] I've searched for [previous similar issues](https://github.com/aws/aws-sdk-cpp/issues) and didn't find any solution
**Describe the bug** **Describe the bug**
A clear and concise description of what the bug is. A clear and concise description of what the bug is.
**SDK version number** **SDK version number**
**Platform/OS/Hardware/Device** **Platform/OS/Hardware/Device**
What are you running the sdk on? What are you running the sdk on?
**To Reproduce (observed behavior)** **To Reproduce (observed behavior)**
Steps to reproduce the behavior (please share code) Steps to reproduce the behavior (please share code)
**Expected behavior** **Expected behavior**
A clear and concise description of what you expected to happen. A clear and concise description of what you expected to happen.
**Logs/output** **Logs/output**
If applicable, add logs or error output. If applicable, add logs or error output.
*REMEMBER TO SANITIZE YOUR PERSONAL INFO* *REMEMBER TO SANITIZE YOUR PERSONAL INFO*
**Additional context** **Additional context**
Add any other context about the problem here. Add any other context about the problem here.

View file

@ -1,20 +1,20 @@
--- ---
name: "\U0001F680 Feature request" name: "\U0001F680 Feature request"
about: Suggest an idea for this project about: Suggest an idea for this project
title: '' title: ''
labels: feature-request, needs-triage labels: feature-request, needs-triage
assignees: '' assignees: ''
--- ---
**Is your feature request related to a problem? Please describe.** **Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like** **Describe the solution you'd like**
A clear and concise description of what you want to happen. A clear and concise description of what you want to happen.
**Describe alternatives you've considered** **Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered. A clear and concise description of any alternative solutions or features you've considered.
**Additional context** **Additional context**
Add any other context or screenshots about the feature request here. Add any other context or screenshots about the feature request here.

View file

@ -1,23 +1,23 @@
--- ---
name: "\U0001F4AC Questions / Help" name: "\U0001F4AC Questions / Help"
about: If you have questions, please check AWS Forums or StackOverflow about: If you have questions, please check AWS Forums or StackOverflow
title: '' title: ''
labels: guidance, needs-triage labels: guidance, needs-triage
assignees: '' assignees: ''
--- ---
Confirm by changing [ ] to [x] below: Confirm by changing [ ] to [x] below:
- [ ] I've searched for [previous similar issues](https://github.com/awslabs/aws-crt-php/issues) and didn't find any solution - [ ] I've searched for [previous similar issues](https://github.com/awslabs/aws-crt-php/issues) and didn't find any solution
**Platform/OS/Hardware/Device** **Platform/OS/Hardware/Device**
What are you running the sdk on? What are you running the sdk on?
**Describe the question** **Describe the question**
**Logs/output** **Logs/output**
If applicable, add logs or error output. If applicable, add logs or error output.
*REMEMBER TO SANITIZE YOUR PERSONAL INFO* *REMEMBER TO SANITIZE YOUR PERSONAL INFO*

View file

@ -1,6 +1,6 @@
*Issue #, if available:* *Issue #, if available:*
*Description of changes:* *Description of changes:*
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

View file

@ -2,9 +2,8 @@ name: CI
on: on:
push: push:
branches: branches-ignore:
- '*' - 'main'
- '!main'
env: env:
BUILDER_VERSION: v0.8.18 BUILDER_VERSION: v0.8.18
@ -34,7 +33,7 @@ jobs:
- name: Install ancient PHPUnit - name: Install ancient PHPUnit
run: composer require --dev --ignore-platform-reqs phpunit/phpunit "4.8.36" run: composer require --dev --ignore-platform-reqs phpunit/phpunit "4.8.36"
- name: Install depedencies - name: Install dependencies
run: composer update --no-interaction run: composer update --no-interaction
- name: Build for PHP 5.5 - name: Build for PHP 5.5
@ -72,7 +71,7 @@ jobs:
with: with:
submodules: recursive submodules: recursive
- name: Install depedencies - name: Install dependencies
run: composer update --no-interaction run: composer update --no-interaction
- name: Run tests - name: Run tests
@ -138,6 +137,18 @@ jobs:
matrix: matrix:
version: [10.15] version: [10.15]
steps: steps:
# Force PHP to 8.0
# Doing this because tests fail in PHP 8.1 (default on macos Github Runner as of Dec 2021)
# due to the old version of PHPUnit we're using.
# We're using an old PHPUnit because it's compatible our min supported PHP 5.5.
# Quick fix is to force PHP version back to 8.0, which can still run our tests without error.
# A real solution is to get our tests working on all PHP versions
# (maybe don't use PHPUnit, maybe raise our min supported PHP version so we can upgrade,
# or maybe use PHPUnit-Polyfills so we can use a modern PHPUnit with old PHP)
- name: Setup PHP 8.0
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
- name: Build PHP 8 extension and test - name: Build PHP 8 extension and test
run: | run: |
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')"

View file

@ -1,210 +1,210 @@
# Created by https://www.toptal.com/developers/gitignore/api/autotools,cmake,phpstorm # Created by https://www.toptal.com/developers/gitignore/api/autotools,cmake,phpstorm
# Edit at https://www.toptal.com/developers/gitignore?templates=autotools,cmake,phpstorm # Edit at https://www.toptal.com/developers/gitignore?templates=autotools,cmake,phpstorm
### Autotools ### ### Autotools ###
# http://www.gnu.org/software/automake # http://www.gnu.org/software/automake
Makefile.in Makefile.in
/ar-lib /ar-lib
/mdate-sh /mdate-sh
/py-compile /py-compile
/test-driver /test-driver
/ylwrap /ylwrap
.deps/ .deps/
# http://www.gnu.org/software/autoconf # http://www.gnu.org/software/autoconf
autom4te.cache autom4te.cache
/autoscan.log /autoscan.log
/autoscan-*.log /autoscan-*.log
/aclocal.m4 /aclocal.m4
/compile /compile
/config.guess /config.guess
/config.h.in /config.h.in
/config.log /config.log
/config.status /config.status
/config.sub /config.sub
/configure /configure
/configure.scan /configure.scan
/depcomp /depcomp
/install-sh /install-sh
/missing /missing
/stamp-h1 /stamp-h1
# https://www.gnu.org/software/libtool/ # https://www.gnu.org/software/libtool/
/ltmain.sh /ltmain.sh
# http://www.gnu.org/software/texinfo # http://www.gnu.org/software/texinfo
/texinfo.tex /texinfo.tex
# http://www.gnu.org/software/m4/ # http://www.gnu.org/software/m4/
m4/libtool.m4 m4/libtool.m4
m4/ltoptions.m4 m4/ltoptions.m4
m4/ltsugar.m4 m4/ltsugar.m4
m4/ltversion.m4 m4/ltversion.m4
m4/lt~obsolete.m4 m4/lt~obsolete.m4
# Generated Makefile # Generated Makefile
# (meta build system like autotools, # (meta build system like autotools,
# can automatically generate from config.status script # can automatically generate from config.status script
# (which is called by configure script)) # (which is called by configure script))
Makefile Makefile
### Autotools Patch ### ### Autotools Patch ###
### CMake ### ### CMake ###
CMakeLists.txt.user CMakeLists.txt.user
CMakeCache.txt CMakeCache.txt
CMakeFiles CMakeFiles
CMakeScripts CMakeScripts
Testing Testing
cmake_install.cmake cmake_install.cmake
install_manifest.txt install_manifest.txt
compile_commands.json compile_commands.json
CTestTestfile.cmake CTestTestfile.cmake
_deps _deps
### CMake Patch ### ### CMake Patch ###
# External projects # External projects
*-prefix/ *-prefix/
### PhpStorm ### ### PhpStorm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff # User-specific stuff
.idea/**/workspace.xml .idea/**/workspace.xml
.idea/**/tasks.xml .idea/**/tasks.xml
.idea/**/usage.statistics.xml .idea/**/usage.statistics.xml
.idea/**/dictionaries .idea/**/dictionaries
.idea/**/shelf .idea/**/shelf
.idea/ .idea/
# Generated files # Generated files
.idea/**/contentModel.xml .idea/**/contentModel.xml
# Sensitive or high-churn files # Sensitive or high-churn files
.idea/**/dataSources/ .idea/**/dataSources/
.idea/**/dataSources.ids .idea/**/dataSources.ids
.idea/**/dataSources.local.xml .idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml .idea/**/sqlDataSources.xml
.idea/**/dynamic.xml .idea/**/dynamic.xml
.idea/**/uiDesigner.xml .idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml .idea/**/dbnavigator.xml
# Gradle # Gradle
.idea/**/gradle.xml .idea/**/gradle.xml
.idea/**/libraries .idea/**/libraries
# Gradle and Maven with auto-import # Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files, # When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using # since they will be recreated, and may cause churn. Uncomment if using
# auto-import. # auto-import.
# .idea/artifacts # .idea/artifacts
# .idea/compiler.xml # .idea/compiler.xml
# .idea/jarRepositories.xml # .idea/jarRepositories.xml
# .idea/modules.xml # .idea/modules.xml
# .idea/*.iml # .idea/*.iml
# .idea/modules # .idea/modules
# *.iml # *.iml
# *.ipr # *.ipr
# CMake # CMake
cmake-build-*/ cmake-build-*/
# Mongo Explorer plugin # Mongo Explorer plugin
.idea/**/mongoSettings.xml .idea/**/mongoSettings.xml
# File-based project format # File-based project format
*.iws *.iws
# IntelliJ # IntelliJ
out/ out/
# mpeltonen/sbt-idea plugin # mpeltonen/sbt-idea plugin
.idea_modules/ .idea_modules/
# JIRA plugin # JIRA plugin
atlassian-ide-plugin.xml atlassian-ide-plugin.xml
# Cursive Clojure plugin # Cursive Clojure plugin
.idea/replstate.xml .idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ) # Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml com_crashlytics_export_strings.xml
crashlytics.properties crashlytics.properties
crashlytics-build.properties crashlytics-build.properties
fabric.properties fabric.properties
# Editor-based Rest Client # Editor-based Rest Client
.idea/httpRequests .idea/httpRequests
# Android studio 3.1+ serialized cache file # Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser .idea/caches/build_file_checksums.ser
### PhpStorm Patch ### ### PhpStorm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml # *.iml
# modules.xml # modules.xml
# .idea/misc.xml # .idea/misc.xml
# *.ipr # *.ipr
# Sonarlint plugin # Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint # https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/ .idea/**/sonarlint/
# SonarQube Plugin # SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin # https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml .idea/**/sonarIssues.xml
# Markdown Navigator plugin # Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced # https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml .idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml .idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/ .idea/**/markdown-navigator/
# Cache file creation bug # Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257 # See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$ .idea/$CACHE_FILE$
# CodeStream plugin # CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream # https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml .idea/codestream.xml
# End of https://www.toptal.com/developers/gitignore/api/autotools,cmake,phpstorm # End of https://www.toptal.com/developers/gitignore/api/autotools,cmake,phpstorm
.deps .deps
.libs/ .libs/
build/ build/
configure.in configure.in
configure.ac configure.ac
mkinstalldirs mkinstalldirs
run-tests.php run-tests.php
Makefile.global Makefile.global
acinclude.m4 acinclude.m4
libtool libtool
modules/ modules/
*.lo *.lo
config.h config.h
config.nice config.nice
*.la *.la
Makefile* Makefile*
!Makefile.am !Makefile.am
!Makefile.frag !Makefile.frag
!Makefile.frag.w32 !Makefile.frag.w32
/vendor/ /vendor/
.idea/ .idea/
.DS_Store .DS_Store
composer.lock composer.lock
PHP-Parser*/ PHP-Parser*/
src/*.so src/*.so
src/*.dylib src/*.dylib
src/*.dll src/*.dll
# ignoring output of package.xml as it needs to be generated from ./prepare_release.sh in each publishing # ignoring output of package.xml as it needs to be generated from ./prepare_release.sh in each publishing
package.xml package.xml
*.tgz *.tgz

View file

@ -1,3 +1,3 @@
[submodule "crt/aws-crt-ffi"] [submodule "crt/aws-crt-ffi"]
path = crt/aws-crt-ffi path = crt/aws-crt-ffi
url = https://github.com/awslabs/aws-crt-ffi.git url = https://github.com/awslabs/aws-crt-ffi.git

View file

@ -1,4 +1,4 @@
## Code of Conduct ## Code of Conduct
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
opensource-codeofconduct@amazon.com with any additional questions or comments. opensource-codeofconduct@amazon.com with any additional questions or comments.

View file

@ -1,61 +1,61 @@
# Contributing Guidelines # Contributing Guidelines
Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
documentation, we greatly value feedback and contributions from our community. documentation, we greatly value feedback and contributions from our community.
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
information to effectively respond to your bug report or contribution. information to effectively respond to your bug report or contribution.
## Reporting Bugs/Feature Requests ## Reporting Bugs/Feature Requests
We welcome you to use the GitHub issue tracker to report bugs or suggest features. We welcome you to use the GitHub issue tracker to report bugs or suggest features.
When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful: reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
* A reproducible test case or series of steps * A reproducible test case or series of steps
* The version of our code being used * The version of our code being used
* Any modifications you've made relevant to the bug * Any modifications you've made relevant to the bug
* Anything unusual about your environment or deployment * Anything unusual about your environment or deployment
## Contributing via Pull Requests ## Contributing via Pull Requests
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that: Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
1. You are working against the latest source on the *master* branch. 1. You are working against the latest source on the *master* branch.
2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
3. You open an issue to discuss any significant work - we would hate for your time to be wasted. 3. You open an issue to discuss any significant work - we would hate for your time to be wasted.
To send us a pull request, please: To send us a pull request, please:
1. Fork the repository. 1. Fork the repository.
2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change. 2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
3. Ensure local tests pass. 3. Ensure local tests pass.
4. Commit to your fork using clear commit messages. 4. Commit to your fork using clear commit messages.
5. Send us a pull request, answering any default questions in the pull request interface. 5. Send us a pull request, answering any default questions in the pull request interface.
6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation. 6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/). [creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
## Finding contributions to work on ## Finding contributions to work on
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start. Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
## Code of Conduct ## Code of Conduct
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
opensource-codeofconduct@amazon.com with any additional questions or comments. opensource-codeofconduct@amazon.com with any additional questions or comments.
## Security issue notifications ## Security issue notifications
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue. If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.
## Licensing ## Licensing
See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes. We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.

View file

@ -1,175 +1,175 @@
Apache License Apache License
Version 2.0, January 2004 Version 2.0, January 2004
http://www.apache.org/licenses/ http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions. 1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, "License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document. and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by "Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License. the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all "Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition, control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the "control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity. outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity "You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License. exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, "Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation including but not limited to software source code, documentation
source, and configuration files. source, and configuration files.
"Object" form shall mean any form resulting from mechanical "Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation, not limited to compiled object code, generated documentation,
and conversions to other media types. and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or "Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work copyright notice that is included in or attached to the work
(an example is provided in the Appendix below). (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object "Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of, separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof. the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including "Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted" the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems, communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution." designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity "Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work. subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of 2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual, this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of, copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form. Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of 3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual, this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made, (except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work, use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s) Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate granted to You under this License for that Work shall terminate
as of the date such litigation is filed. as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the 4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You modifications, and in Source or Object form, provided that You
meet the following conditions: meet the following conditions:
(a) You must give any other recipients of the Work or (a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices (b) You must cause any modified files to carry prominent notices
stating that You changed the files; and stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works (c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work, attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of excluding those notices that do not pertain to any part of
the Derivative Works; and the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its (d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or, documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed that such additional attribution notices cannot be construed
as modifying the License. as modifying the License.
You may add Your own copyright statement to Your modifications and You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use, for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License. the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, 5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions. this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions. with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade 6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor, names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file. origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or 7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS, Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License. risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, 8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise, whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special, liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill, Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages. has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing 9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer, the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity, and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify, of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability. of your accepting any such warranty or additional liability.

View file

@ -1,72 +1,72 @@
INT_DIR=build/install INT_DIR=build/install
GENERATE_STUBS=$(shell expr `php --version | head -1 | cut -f 2 -d' '` \>= 7.1) GENERATE_STUBS=$(shell expr `php --version | head -1 | cut -f 2 -d' '` \>= 7.1)
CMAKE = cmake3 CMAKE = cmake3
ifeq (, $(shell which cmake3)) ifeq (, $(shell which cmake3))
CMAKE = cmake CMAKE = cmake
endif endif
# default to using system OpenSSL, if disabled aws-lc will be used # default to using system OpenSSL, if disabled aws-lc will be used
USE_OPENSSL ?= ON USE_OPENSSL ?= ON
ifneq (OFF,$(USE_OPENSSL)) ifneq (OFF,$(USE_OPENSSL))
CMAKE_USE_OPENSSL=-DUSE_OPENSSL=ON CMAKE_USE_OPENSSL=-DUSE_OPENSSL=ON
# if a path was provided, add it to CMAKE_PREFIX_PATH # if a path was provided, add it to CMAKE_PREFIX_PATH
ifneq (ON,$(USE_OPENSSL)) ifneq (ON,$(USE_OPENSSL))
CMAKE_PREFIX_PATH=-DCMAKE_PREFIX_PATH=$(USE_OPENSSL) CMAKE_PREFIX_PATH=-DCMAKE_PREFIX_PATH=$(USE_OPENSSL)
endif endif
endif endif
CMAKE_CONFIGURE = $(CMAKE) \ CMAKE_CONFIGURE = $(CMAKE) \
-DCMAKE_INSTALL_PREFIX=$(INT_DIR) \ -DCMAKE_INSTALL_PREFIX=$(INT_DIR) \
-DBUILD_TESTING=OFF \ -DBUILD_TESTING=OFF \
-DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \ -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \
$(CMAKE_USE_OPENSSL) \ $(CMAKE_USE_OPENSSL) \
$(CMAKE_PREFIX_PATH) $(CMAKE_PREFIX_PATH)
CMAKE_BUILD = CMAKE_BUILD_PARALLEL_LEVEL='' $(CMAKE) --build CMAKE_BUILD = CMAKE_BUILD_PARALLEL_LEVEL='' $(CMAKE) --build
CMAKE_BUILD_TYPE ?= RelWithDebInfo CMAKE_BUILD_TYPE ?= RelWithDebInfo
CMAKE_TARGET = --config $(CMAKE_BUILD_TYPE) --target install CMAKE_TARGET = --config $(CMAKE_BUILD_TYPE) --target install
all: extension all: extension
.PHONY: all extension .PHONY: all extension
# configure for static aws-crt-ffi.a # configure for static aws-crt-ffi.a
build/aws-crt-ffi-static/CMakeCache.txt: build/aws-crt-ffi-static/CMakeCache.txt:
$(CMAKE_CONFIGURE) -Hcrt/aws-crt-ffi -Bbuild/aws-crt-ffi-static -DBUILD_SHARED_LIBS=OFF $(CMAKE_CONFIGURE) -Hcrt/aws-crt-ffi -Bbuild/aws-crt-ffi-static -DBUILD_SHARED_LIBS=OFF
# build static libaws-crt-ffi.a # build static libaws-crt-ffi.a
build/aws-crt-ffi-static/libaws-crt-ffi.a: build/aws-crt-ffi-static/CMakeCache.txt build/aws-crt-ffi-static/libaws-crt-ffi.a: build/aws-crt-ffi-static/CMakeCache.txt
$(CMAKE_BUILD) build/aws-crt-ffi-static $(CMAKE_TARGET) $(CMAKE_BUILD) build/aws-crt-ffi-static $(CMAKE_TARGET)
# PHP extension target # PHP extension target
extension: ext/awscrt.lo extension: ext/awscrt.lo
# Force the crt object target to depend on the CRT static library # Force the crt object target to depend on the CRT static library
ext/awscrt.lo: ext/awscrt.c ext/awscrt.lo: ext/awscrt.c
ext/awscrt.c: build/aws-crt-ffi-static/libaws-crt-ffi.a ext/api.h ext/awscrt_arginfo.h ext/awscrt.c: build/aws-crt-ffi-static/libaws-crt-ffi.a ext/api.h ext/awscrt_arginfo.h
ext/awscrt_arginfo.h: ext/awscrt.stub.php gen_stub.php ext/awscrt_arginfo.h: ext/awscrt.stub.php gen_stub.php
ifeq ($(GENERATE_STUBS),1) ifeq ($(GENERATE_STUBS),1)
# generate awscrt_arginfo.h # generate awscrt_arginfo.h
php gen_stub.php --minimal-arginfo ext/awscrt.stub.php php gen_stub.php --minimal-arginfo ext/awscrt.stub.php
endif endif
# transform/install api.h from FFI lib # transform/install api.h from FFI lib
src/api.h: crt/aws-crt-ffi/src/api.h src/api.h: crt/aws-crt-ffi/src/api.h
php gen_api.php crt/aws-crt-ffi/src/api.h > src/api.h php gen_api.php crt/aws-crt-ffi/src/api.h > src/api.h
# install api.h to ext/ as well # install api.h to ext/ as well
ext/api.h : src/api.h ext/api.h : src/api.h
cp -v src/api.h ext/api.h cp -v src/api.h ext/api.h
ext/php_aws_crt.h: ext/awscrt_arginfo.h ext/api.h ext/php_aws_crt.h: ext/awscrt_arginfo.h ext/api.h
vendor/bin/phpunit: vendor/bin/phpunit:
composer update composer update
test-extension: vendor/bin/phpunit extension test-extension: vendor/bin/phpunit extension
composer run test-extension composer run test-extension
# Use PHPUnit to run tests # Use PHPUnit to run tests
test: test-extension test: test-extension

View file

@ -1,35 +1,35 @@
CMAKE=cmake.exe CMAKE=cmake.exe
COMPOSER_PHAR=C:\ProgramData\ComposerSetup\bin\composer.phar COMPOSER_PHAR=C:\ProgramData\ComposerSetup\bin\composer.phar
PHP_BINARY=$(PHP_PREFIX)\php.exe PHP_BINARY=$(PHP_PREFIX)\php.exe
CMAKE_CONFIGURE = $(CMAKE) -DCMAKE_INSTALL_PREFIX=$(AWSCRT_DIR)\build\install -DCMAKE_PREFIX_PATH=$(AWSCRT_DIR)\build\install -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) CMAKE_CONFIGURE = $(CMAKE) -DCMAKE_INSTALL_PREFIX=$(AWSCRT_DIR)\build\install -DCMAKE_PREFIX_PATH=$(AWSCRT_DIR)\build\install -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
CMAKE_BUILD = $(CMAKE) --build CMAKE_BUILD = $(CMAKE) --build
CMAKE_BUILD_TYPE = Release CMAKE_BUILD_TYPE = Release
CMAKE_TARGET = --config $(CMAKE_BUILD_TYPE) --target install CMAKE_TARGET = --config $(CMAKE_BUILD_TYPE) --target install
# configure for static aws-crt-ffi.lib # configure for static aws-crt-ffi.lib
$(AWSCRT_DIR)\build\CMakeCache.txt: $(AWSCRT_DIR)\build\CMakeCache.txt:
$(CMAKE_CONFIGURE) -H$(AWSCRT_DIR)\crt\aws-crt-ffi -B$(AWSCRT_DIR)\build -DBUILD_SHARED_LIBS=OFF $(CMAKE_CONFIGURE) -H$(AWSCRT_DIR)\crt\aws-crt-ffi -B$(AWSCRT_DIR)\build -DBUILD_SHARED_LIBS=OFF
# build static libaws-crt-ffi.lib # build static libaws-crt-ffi.lib
$(AWSCRT_DIR)\build\libaws-crt-ffi.lib: $(AWSCRT_DIR)\build\CMakeCache.txt $(AWSCRT_DIR)\build\libaws-crt-ffi.lib: $(AWSCRT_DIR)\build\CMakeCache.txt
$(CMAKE_BUILD) $(AWSCRT_DIR)\build $(CMAKE_TARGET) $(CMAKE_BUILD) $(AWSCRT_DIR)\build $(CMAKE_TARGET)
# Force the awscrt extension DLL target to depend on the extension src # Force the awscrt extension DLL target to depend on the extension src
$(BUILD_DIR)\php_awscrt.dll: $(AWSCRT_DIR)\ext\awscrt.c $(BUILD_DIR)\php_awscrt.dll: $(AWSCRT_DIR)\ext\awscrt.c
$(AWSCRT_DIR)\ext\awscrt.c: $(AWSCRT_DIR)\build\libaws-crt-ffi.lib $(AWSCRT_DIR)\ext\api.h $(AWSCRT_DIR)\ext\awscrt_arginfo.h $(AWSCRT_DIR)\ext\awscrt.c: $(AWSCRT_DIR)\build\libaws-crt-ffi.lib $(AWSCRT_DIR)\ext\api.h $(AWSCRT_DIR)\ext\awscrt_arginfo.h
# transform\install api.h from FFI lib # transform\install api.h from FFI lib
$(AWSCRT_DIR)\src\api.h: $(AWSCRT_DIR)\crt\aws-crt-ffi\src\api.h $(AWSCRT_DIR)\src\api.h: $(AWSCRT_DIR)\crt\aws-crt-ffi\src\api.h
php $(AWSCRT_DIR)\gen_api.php $(AWSCRT_DIR)\crt\aws-crt-ffi\src\api.h > $(AWSCRT_DIR)\src\api.h php $(AWSCRT_DIR)\gen_api.php $(AWSCRT_DIR)\crt\aws-crt-ffi\src\api.h > $(AWSCRT_DIR)\src\api.h
# install api.h to ext/ as well # install api.h to ext/ as well
$(AWSCRT_DIR)\ext\api.h : $(AWSCRT_DIR)\src\api.h $(AWSCRT_DIR)\ext\api.h : $(AWSCRT_DIR)\src\api.h
copy $(AWSCRT_DIR)\src\api.h $(AWSCRT_DIR)\ext\api.h copy $(AWSCRT_DIR)\src\api.h $(AWSCRT_DIR)\ext\api.h
# Use PHPUnit to run tests # Use PHPUnit to run tests
test-awscrt: install $(AWSCRT_DIR)\src\api.h $(BUILD_DIR)\php_awscrt.dll test-awscrt: install $(AWSCRT_DIR)\src\api.h $(BUILD_DIR)\php_awscrt.dll
$(PHP_BINARY) -c $(AWSCRT_DIR)\php-win.ini $(COMPOSER_PHAR) --working-dir=$(AWSCRT_DIR) update $(PHP_BINARY) -c $(AWSCRT_DIR)\php-win.ini $(COMPOSER_PHAR) --working-dir=$(AWSCRT_DIR) update
$(PHP_BINARY) -c $(AWSCRT_DIR)\php-win.ini $(COMPOSER_PHAR) --working-dir=$(AWSCRT_DIR) run test-win $(PHP_BINARY) -c $(AWSCRT_DIR)\php-win.ini $(COMPOSER_PHAR) --working-dir=$(AWSCRT_DIR) run test-win

View file

@ -1 +1 @@
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

View file

@ -1,80 +1,87 @@
# AWS Common Runtime PHP bindings # AWS Common Runtime PHP bindings
## Requirements ## Requirements
* PHP 5.5+ on UNIX platforms, 7.2+ on Windows * PHP 5.5+ on UNIX platforms, 7.2+ on Windows
* CMake 3.x * CMake 3.x
* GCC 4.4+, clang 3.8+ on UNIX, Visual Studio 2017 build tools on Windows * GCC 4.4+, clang 3.8+ on UNIX, Visual Studio 2017 build tools on Windows
* Tests require [Composer](https://getcomposer.org) * Tests require [Composer](https://getcomposer.org)
## Building on UNIX ## Building on UNIX
```sh ```sh
$ git clone --recursive https://github.com/awslabs/aws-crt-php.git $ git clone --recursive https://github.com/awslabs/aws-crt-php.git
$ cd aws-crt-php $ cd aws-crt-php
$ phpize $ phpize
$ ./configure $ ./configure
$ make && make test $ make && make test
``` ```
## Building on Windows ## Building on Windows
* First, ensure that you are able to build PHP on windows via the PHP SDK (this example assumes installation of the SDK to C:\php-sdk and that you've checked out the PHP source to php-src within the build directory). The following resources are helpful to get PHP building on windows: * First, ensure that you are able to build PHP on windows via the PHP SDK (this example assumes installation of the SDK to C:\php-sdk and that you've checked out the PHP source to php-src within the build directory). The following resources are helpful to get PHP building on windows:
* https://github.com/microsoft/php-sdk-binary-tools * https://github.com/microsoft/php-sdk-binary-tools
* https://medium.com/@erinus/how-to-build-php-on-windows-a7ad0a87862a * https://medium.com/@erinus/how-to-build-php-on-windows-a7ad0a87862a
* https://medium.com/@erinus/how-to-build-php-extension-on-windows-d1667290f809 * https://medium.com/@erinus/how-to-build-php-extension-on-windows-d1667290f809
```bat ```bat
""" From VS2017 Command Prompt """ From VS2017 Command Prompt
> C:\php-sdk\phpsdk-vc15-x64.bat > C:\php-sdk\phpsdk-vc15-x64.bat
C:\php-sdk\ C:\php-sdk\
$ phpsdk_buildtree php-<version> $ phpsdk_buildtree php-<version>
C:\php-sdk\php-<version>\vc15\x64\ C:\php-sdk\php-<version>\vc15\x64\
$ git clone https://github.com/php/php-src.git && cd php-src $ git clone https://github.com/php/php-src.git && cd php-src
""" This only has to be done once, the first time you set this all up """ This only has to be done once, the first time you set this all up
C:\php-sdk\php-<version>\vc15\x64\php-src C:\php-sdk\php-<version>\vc15\x64\php-src
$ phpsdk_deps --update --branch <php-major.minor-version> $ phpsdk_deps --update --branch <php-major.minor-version>
C:\php-sdk\php-<version>\vc15\x64\php-src C:\php-sdk\php-<version>\vc15\x64\php-src
$ git clone --recursive https://github.com/awslabs/aws-crt-php.git ..\pecl\awscrt $ git clone --recursive https://github.com/awslabs/aws-crt-php.git ..\pecl\awscrt
C:\php-sdk\php-<version>\vc15\x64\php-src C:\php-sdk\php-<version>\vc15\x64\php-src
$ buildconf $ buildconf
C:\php-sdk\php-<version>\vc15\x64\php-src C:\php-sdk\php-<version>\vc15\x64\php-src
$ configure --enable-cli --with-openssl --enable-awscrt=shared $ configure --enable-cli --with-openssl --enable-awscrt=shared
C:\php-sdk\php-<version>\vc15\x64\php-src C:\php-sdk\php-<version>\vc15\x64\php-src
$ nmake $ nmake
C:\php-sdk\php-<version>\vc15\x64\php-src C:\php-sdk\php-<version>\vc15\x64\php-src
$ nmake test-awscrt $ nmake test-awscrt
``` ```
## Debugging Note: for VS2017, Cmake will default to build for Win32, refer to [here](https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2015%202017.html). If you are building for x64 php, you can set environment variable as follow to let cmake pick x64 compiler.
Using [PHPBrew](https://github.com/phpbrew/phpbrew) to build/manage multiple versions of PHP is helpful.
```bat
Note: You must use a debug build of PHP to debug native extensions. set CMAKE_GENERATOR=Visual Studio 15 2017
See the [PHP Internals Book](https://www.phpinternalsbook.com/php7/build_system/building_php.html) for more info set CMAKE_GENERATOR_PLATFORM=x64
```
```shell
# PHP 8 example ## Debugging
$ phpbrew install --stdout -j 8 8.0 +default -- CFLAGS=-Wno-error --disable-cgi --enable-debug Using [PHPBrew](https://github.com/phpbrew/phpbrew) to build/manage multiple versions of PHP is helpful.
# PHP 5.5 example
$ phpbrew install --stdout -j 8 5.5 +default -openssl -mbstring -- CFLAGS="-w -Wno-error" --enable-debug --with-zlib=/usr/local/opt/zlib Note: You must use a debug build of PHP to debug native extensions.
$ phpbrew switch php-8.0.6 # or whatever version is current, it'll be at the end of the build output See the [PHP Internals Book](https://www.phpinternalsbook.com/php7/build_system/building_php.html) for more info
$ phpize
$ ./configure ```shell
$ make CMAKE_BUILD_TYPE=Debug # PHP 8 example
``` $ phpbrew install --stdout -j 8 8.0 +default -- CFLAGS=-Wno-error --disable-cgi --enable-debug
# PHP 5.5 example
Ensure that the php you launch from your debugger is the result of `which php`, not just $ phpbrew install --stdout -j 8 5.5 +default -openssl -mbstring -- CFLAGS="-w -Wno-error" --enable-debug --with-zlib=/usr/local/opt/zlib
the system default php. $ phpbrew switch php-8.0.6 # or whatever version is current, it'll be at the end of the build output
$ phpize
## Security $ ./configure
$ make CMAKE_BUILD_TYPE=Debug
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information. ```
## License Ensure that the php you launch from your debugger is the result of `which php`, not just
the system default php.
This project is licensed under the Apache-2.0 License.
## Security
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
## License
This project is licensed under the Apache-2.0 License.

View file

@ -1,37 +1,37 @@
{ {
"name": "aws-crt-php", "name": "aws-crt-php",
"hosts": { "hosts": {
"ubuntu": { "ubuntu": {
"pkg_setup": [ "pkg_setup": [
"add-apt-repository -y ppa:ondrej/php" "add-apt-repository -y ppa:ondrej/php"
], ],
"packages": [ "packages": [
"autotools-dev", "autotools-dev",
"autoconf", "autoconf",
"libtool", "libtool",
"clang", "clang",
"php5.6-dev" "php5.6-dev"
] ]
}, },
"al2": { "al2": {
"packages": [ "packages": [
"autoconf", "autoconf",
"automake", "automake",
"libtool", "libtool",
"clang", "clang",
"php-devel" "php-devel"
] ]
} }
}, },
"build_steps": [ "build_steps": [
["phpize"], ["phpize"],
["./configure"], ["./configure"],
["make"] ["make"]
], ],
"test_env": { "test_env": {
"NO_INTERACTION": "1" "NO_INTERACTION": "1"
}, },
"test_steps": [ "test_steps": [
["./run_tests"] ["./run_tests"]
] ]
} }

View file

@ -1,34 +1,34 @@
{ {
"name": "aws/aws-crt-php", "name": "aws/aws-crt-php",
"homepage": "http://aws.amazon.com/sdkforphp", "homepage": "http://aws.amazon.com/sdkforphp",
"description": "AWS Common Runtime for PHP", "description": "AWS Common Runtime for PHP",
"keywords": ["aws","amazon","sdk","crt"], "keywords": ["aws","amazon","sdk","crt"],
"type": "library", "type": "library",
"authors": [ "authors": [
{ {
"name": "AWS SDK Common Runtime Team", "name": "AWS SDK Common Runtime Team",
"email": "aws-sdk-common-runtime@amazon.com" "email": "aws-sdk-common-runtime@amazon.com"
} }
], ],
"config": { "config": {
"platform": {"php": "5.6"} "platform": {"php": "5.6"}
}, },
"minimum-stability": "alpha", "minimum-stability": "alpha",
"require": { "require": {
"php": ">=5.5" "php": ">=5.5"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit":"^4.8.35|^5.4.3" "phpunit/phpunit":"^4.8.35|^5.6.3"
}, },
"autoload": { "autoload": {
"classmap": [ "classmap": [
"src/" "src/"
] ]
}, },
"scripts": { "scripts": {
"test": "./run_tests", "test": "./run_tests",
"test-extension": "@test", "test-extension": "@test",
"test-win": "run_tests" "test-win": "run_tests"
}, },
"license": "Apache-2.0" "license": "Apache-2.0"
} }

View file

@ -1,30 +1,30 @@
dnl dnl
dnl * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. dnl * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
dnl * SPDX-License-Identifier: Apache-2.0. dnl * SPDX-License-Identifier: Apache-2.0.
dnl dnl
PHP_ARG_WITH(awscrt, for AWS Common Runtime support, PHP_ARG_WITH(awscrt, for AWS Common Runtime support,
[ --with-awscrt Include awscrt support]) [ --with-awscrt Include awscrt support])
if test "$PHP_AWSCRT" != "no"; then if test "$PHP_AWSCRT" != "no"; then
# force lib paths to be absolute, or PHP will mangle them # force lib paths to be absolute, or PHP will mangle them
cwd=`pwd` cwd=`pwd`
# Enable s2n and libcrypto for non-darwin UNIX # Enable s2n and libcrypto for non-darwin UNIX
if uname -a | grep -i darwin > /dev/null 2>&1; then if uname -a | grep -i darwin > /dev/null 2>&1; then
platform_tls_libs="" platform_tls_libs=""
else else
platform_tls_libs="-ls2n -lcrypto" platform_tls_libs="-ls2n -lcrypto"
fi fi
CRT_LIBPATHS="-L${cwd}/build/install/lib -L${cwd}/build/install/lib64" CRT_LIBPATHS="-L${cwd}/build/install/lib -L${cwd}/build/install/lib64"
CRT_LIBS="-laws-crt-ffi -laws-c-auth -laws-c-http -laws-c-io -laws-c-cal -laws-c-compression -laws-checksums -laws-c-common ${platform_tls_libs}" CRT_LIBS="-laws-crt-ffi -laws-c-auth -laws-c-http -laws-c-io -laws-c-cal -laws-c-compression -laws-checksums -laws-c-common ${platform_tls_libs}"
PHP_ADD_INCLUDE(${cwd}/build/install/include) PHP_ADD_INCLUDE(${cwd}/build/install/include)
PHP_EVAL_LIBLINE([$CRT_LIBPATHS $CRT_LIBS], AWSCRT_SHARED_LIBADD) PHP_EVAL_LIBLINE([$CRT_LIBPATHS $CRT_LIBS], AWSCRT_SHARED_LIBADD)
# Shoves the linker line into the Makefile # Shoves the linker line into the Makefile
PHP_SUBST(AWSCRT_SHARED_LIBADD) PHP_SUBST(AWSCRT_SHARED_LIBADD)
# Sources for the PHP extension itself # Sources for the PHP extension itself
AWSCRT_SOURCES=ext/awscrt.c AWSCRT_SOURCES=ext/awscrt.c
PHP_NEW_EXTENSION(awscrt, $AWSCRT_SOURCES, $ext_shared) PHP_NEW_EXTENSION(awscrt, $AWSCRT_SOURCES, $ext_shared)
PHP_ADD_MAKEFILE_FRAGMENT PHP_ADD_MAKEFILE_FRAGMENT
fi fi

View file

@ -1,13 +1,13 @@
// vim:ft=javascript // vim:ft=javascript
ARG_ENABLE("awscrt", "Include AWS Common Runtime support", "yes"); ARG_ENABLE("awscrt", "Include AWS Common Runtime support", "yes");
if (PHP_AWSCRT != "no") { if (PHP_AWSCRT != "no") {
ADD_MAKEFILE_FRAGMENT(); ADD_MAKEFILE_FRAGMENT();
DEFINE('CFLAGS_AWSCRT', '/I ' + configure_module_dirname + '\\build\\install\\include'); DEFINE('CFLAGS_AWSCRT', '/I ' + configure_module_dirname + '\\build\\install\\include');
DEFINE('LIBS_AWSCRT', '/LIBPATH:' + configure_module_dirname + '\\build\\install\\lib ' + DEFINE('LIBS_AWSCRT', '/LIBPATH:' + configure_module_dirname + '\\build\\install\\lib ' +
'aws-crt-ffi.lib aws-c-auth.lib aws-c-http.lib aws-c-io.lib aws-c-cal.lib aws-c-compression.lib aws-c-common.lib ' + 'aws-crt-ffi.lib aws-c-auth.lib aws-c-http.lib aws-c-io.lib aws-c-cal.lib aws-c-compression.lib aws-checksums.lib aws-c-common.lib ' +
'ncrypt.lib Secur32.lib Crypt32.lib Shlwapi.lib'); 'ncrypt.lib Secur32.lib Crypt32.lib Shlwapi.lib');
DEFINE('AWSCRT_DIR', configure_module_dirname); DEFINE('AWSCRT_DIR', configure_module_dirname);
EXTENSION("awscrt", "ext\\awscrt.c", PHP_AWSCRT_SHARED); EXTENSION("awscrt", "ext\\awscrt.c", PHP_AWSCRT_SHARED);
} }

View file

@ -1,2 +1,2 @@
*.so *.so
api.h api.h

View file

@ -1,17 +1,17 @@
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
/* This is a unity-build style source file, as PHP's build system is simplest with 1 source file per extension */ /* This is a unity-build style source file, as PHP's build system is simplest with 1 source file per extension */
#include "credentials.c" #include "credentials.c"
#include "crt.c" #include "crt.c"
#include "event_loop.c" #include "event_loop.c"
#include "http.c" #include "http.c"
#include "signing.c" #include "signing.c"
#include "stream.c" #include "stream.c"
// #include "hash.c" // #include "hash.c"
#include "crc.c" #include "crc.c"
#include "logging.c" #include "logging.c"
#include "php_util.c" #include "php_util.c"

View file

@ -1,88 +1,88 @@
<?php <?php
/** /**
* @generate-class-entries * @generate-class-entries
* @generate-function-entries * @generate-function-entries
*/ */
function aws_crt_last_error(): int {} function aws_crt_last_error(): int {}
function aws_crt_error_name(int $error_code): string {} function aws_crt_error_name(int $error_code): string {}
function aws_crt_error_str(int $error_code): string {} function aws_crt_error_str(int $error_code): string {}
function aws_crt_error_debug_str(int $error_code): string {} function aws_crt_error_debug_str(int $error_code): string {}
function aws_crt_log_to_stdout(): void {} function aws_crt_log_to_stdout(): void {}
function aws_crt_log_to_stderr(): void {} function aws_crt_log_to_stderr(): void {}
function aws_crt_log_to_file(string $filename): void {} function aws_crt_log_to_file(string $filename): void {}
function aws_crt_log_to_stream(object $stream): void {} function aws_crt_log_to_stream(object $stream): void {}
function aws_crt_log_stop(): void {} function aws_crt_log_stop(): void {}
function aws_crt_log_set_level(int $level): void {} function aws_crt_log_set_level(int $level): void {}
function aws_crt_log_message(string $message): void {} function aws_crt_log_message(string $message): void {}
function aws_crt_event_loop_group_options_new(): int {} function aws_crt_event_loop_group_options_new(): int {}
function aws_crt_event_loop_group_options_release(int $elg_options): void {} function aws_crt_event_loop_group_options_release(int $elg_options): void {}
function aws_crt_event_loop_group_options_set_max_threads(int $elg_options, int $max_threads): void {} function aws_crt_event_loop_group_options_set_max_threads(int $elg_options, int $max_threads): void {}
function aws_crt_event_loop_group_new(object $options): object {} function aws_crt_event_loop_group_new(object $options): object {}
function aws_crt_event_loop_group_release(object $event_loop_group): void {} function aws_crt_event_loop_group_release(object $event_loop_group): void {}
function aws_crt_input_stream_options_new(): object {} function aws_crt_input_stream_options_new(): object {}
function aws_crt_input_stream_options_release(object $options): void {} function aws_crt_input_stream_options_release(object $options): void {}
function aws_crt_input_stream_options_set_user_data(object $options, object $user_data): void {} function aws_crt_input_stream_options_set_user_data(object $options, object $user_data): void {}
function aws_crt_input_stream_new(object $options): object {} function aws_crt_input_stream_new(object $options): object {}
function aws_crt_input_stream_release(int $stream): void {} function aws_crt_input_stream_release(int $stream): void {}
function aws_crt_input_stream_seek(int $stream, int $offset, int $basis): int {} function aws_crt_input_stream_seek(int $stream, int $offset, int $basis): int {}
function aws_crt_input_stream_read(int $stream, int $length): string {} function aws_crt_input_stream_read(int $stream, int $length): string {}
function aws_crt_input_stream_eof(int $stream): bool {} function aws_crt_input_stream_eof(int $stream): bool {}
function aws_crt_input_stream_get_length(int $stream): int {} function aws_crt_input_stream_get_length(int $stream): int {}
function aws_crt_http_message_new_from_blob(string $blob): int {} function aws_crt_http_message_new_from_blob(string $blob): int {}
function aws_crt_http_message_to_blob(int $message): string {} function aws_crt_http_message_to_blob(int $message): string {}
function aws_crt_http_message_release(int $message): void {} function aws_crt_http_message_release(int $message): void {}
function aws_crt_credentials_options_new(): object {} function aws_crt_credentials_options_new(): object {}
function aws_crt_credentials_options_release(object $options): void {} function aws_crt_credentials_options_release(object $options): void {}
function aws_crt_credentials_options_set_access_key_id(object $options, string $access_key_id): void {} function aws_crt_credentials_options_set_access_key_id(object $options, string $access_key_id): void {}
function aws_crt_credentials_options_set_secret_access_key(object $options, string $secret_access_key): void {} function aws_crt_credentials_options_set_secret_access_key(object $options, string $secret_access_key): void {}
function aws_crt_credentials_options_set_session_token(object $options, string $session_token): void {} function aws_crt_credentials_options_set_session_token(object $options, string $session_token): void {}
function aws_crt_credentials_options_set_expiration_timepoint_seconds(object $options, int $expiration_timepoint_seconds): void {} function aws_crt_credentials_options_set_expiration_timepoint_seconds(object $options, int $expiration_timepoint_seconds): void {}
function aws_crt_credentials_new(object $options): object {} function aws_crt_credentials_new(object $options): object {}
function aws_crt_credentials_release(object $credentials): void {} function aws_crt_credentials_release(object $credentials): void {}
function aws_crt_credentials_provider_release(int $credentials): void {} function aws_crt_credentials_provider_release(int $credentials): void {}
function aws_crt_credentials_provider_static_options_new(): object {} function aws_crt_credentials_provider_static_options_new(): object {}
function aws_crt_credentials_provider_static_options_release(object $options): void {} function aws_crt_credentials_provider_static_options_release(object $options): void {}
function aws_crt_credentials_provider_static_options_set_access_key_id(object $options, string $access_key_id): void {} function aws_crt_credentials_provider_static_options_set_access_key_id(object $options, string $access_key_id): void {}
function aws_crt_credentials_provider_static_options_set_secret_access_key(object $options, string $secret_access_key): void {} function aws_crt_credentials_provider_static_options_set_secret_access_key(object $options, string $secret_access_key): void {}
function aws_crt_credentials_provider_static_options_set_session_token(object $options, string $session_token): void {} function aws_crt_credentials_provider_static_options_set_session_token(object $options, string $session_token): void {}
function aws_crt_credentials_provider_static_new(object $options): object {} function aws_crt_credentials_provider_static_new(object $options): object {}
function aws_crt_signing_config_aws_new(): int {} function aws_crt_signing_config_aws_new(): int {}
function aws_crt_signing_config_aws_release(int $config): void {} function aws_crt_signing_config_aws_release(int $config): void {}
function aws_crt_signing_config_aws_set_algorithm(int $config, int $algorithm): void {} function aws_crt_signing_config_aws_set_algorithm(int $config, int $algorithm): void {}
function aws_crt_signing_config_aws_set_signature_type(int $config, int $signature_type): void {} function aws_crt_signing_config_aws_set_signature_type(int $config, int $signature_type): void {}
function aws_crt_signing_config_aws_set_credentials_provider(int $config, int $credentials_provider): void {} function aws_crt_signing_config_aws_set_credentials_provider(int $config, int $credentials_provider): void {}
function aws_crt_signing_config_aws_set_region(int $config, string $region): void {} function aws_crt_signing_config_aws_set_region(int $config, string $region): void {}
function aws_crt_signing_config_aws_set_service(int $config, string $service): void {} function aws_crt_signing_config_aws_set_service(int $config, string $service): void {}
function aws_crt_signing_config_aws_set_use_double_uri_encode(int $config, bool $use_double_uri_encode): void {} function aws_crt_signing_config_aws_set_use_double_uri_encode(int $config, bool $use_double_uri_encode): void {}
function aws_crt_signing_config_aws_set_should_normalize_uri_path(int $config, bool $should_normalize_uri_path): void {} function aws_crt_signing_config_aws_set_should_normalize_uri_path(int $config, bool $should_normalize_uri_path): void {}
function aws_crt_signing_config_aws_set_omit_session_token(int $config, bool $omit_session_token): void {} function aws_crt_signing_config_aws_set_omit_session_token(int $config, bool $omit_session_token): void {}
function aws_crt_signing_config_aws_set_signed_body_value(int $config, string $signed_body_value): void {} function aws_crt_signing_config_aws_set_signed_body_value(int $config, string $signed_body_value): void {}
function aws_crt_signing_config_aws_set_signed_body_header_type(int $config, int $signed_body_header_type): void {} function aws_crt_signing_config_aws_set_signed_body_header_type(int $config, int $signed_body_header_type): void {}
function aws_crt_signing_config_aws_set_expiration_in_seconds(int $config, int $expiration_in_seconds): void {} function aws_crt_signing_config_aws_set_expiration_in_seconds(int $config, int $expiration_in_seconds): void {}
function aws_crt_signing_config_aws_set_date(int $config, int $timestamp): void {} function aws_crt_signing_config_aws_set_date(int $config, int $timestamp): void {}
function aws_crt_signing_config_aws_set_should_sign_header_fn(int $config, object $should_sign_header): void {} function aws_crt_signing_config_aws_set_should_sign_header_fn(int $config, object $should_sign_header): void {}
function aws_crt_signable_new_from_http_request(int $http_message): int {} function aws_crt_signable_new_from_http_request(int $http_message): int {}
function aws_crt_signable_new_from_chunk(int $input_stream, string $previous_signature): int {} function aws_crt_signable_new_from_chunk(int $input_stream, string $previous_signature): int {}
function aws_crt_signable_new_from_canonical_request(string $request): int {} function aws_crt_signable_new_from_canonical_request(string $request): int {}
function aws_crt_signable_release(int $signable): void {} function aws_crt_signable_release(int $signable): void {}
function aws_crt_signing_result_release(int $signing_result): void {} function aws_crt_signing_result_release(int $signing_result): void {}
function aws_crt_signing_result_apply_to_http_request(object $signing_result, object $http_request): void {} function aws_crt_signing_result_apply_to_http_request(object $signing_result, object $http_request): void {}
function aws_crt_sign_request_aws(int $signable, int $signing_config, object $on_complete, object $user_data): int {} function aws_crt_sign_request_aws(int $signable, int $signing_config, object $on_complete, object $user_data): int {}
function aws_crt_test_verify_sigv4a_signing(int $signable, int $signing_config, string $expected_canonical_request, string $signature, string $ecc_key_pub_x, string $ecc_key_pub_y): bool {} function aws_crt_test_verify_sigv4a_signing(int $signable, int $signing_config, string $expected_canonical_request, string $signature, string $ecc_key_pub_x, string $ecc_key_pub_y): bool {}
function aws_crt_crc32(string $input, int $prev): int {} function aws_crt_crc32(string $input, int $prev): int {}
function aws_crt_crc32c(string $input, int $prev): int {} function aws_crt_crc32c(string $input, int $prev): int {}

View file

@ -1,413 +1,413 @@
/* This is a generated file, edit the .stub.php file instead. /* This is a generated file, edit the .stub.php file instead.
* Stub hash: 344f9d59b85697b80bb6808ac7d5eb7c1d07c03f */ * Stub hash: 344f9d59b85697b80bb6808ac7d5eb7c1d07c03f */
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_last_error, 0, 0, 0) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_last_error, 0, 0, 0)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_error_name, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_error_name, 0, 0, 1)
ZEND_ARG_INFO(0, error_code) ZEND_ARG_INFO(0, error_code)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
#define arginfo_aws_crt_error_str arginfo_aws_crt_error_name #define arginfo_aws_crt_error_str arginfo_aws_crt_error_name
#define arginfo_aws_crt_error_debug_str arginfo_aws_crt_error_name #define arginfo_aws_crt_error_debug_str arginfo_aws_crt_error_name
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_to_stdout, 0, 0, 0) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_to_stdout, 0, 0, 0)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
#define arginfo_aws_crt_log_to_stderr arginfo_aws_crt_log_to_stdout #define arginfo_aws_crt_log_to_stderr arginfo_aws_crt_log_to_stdout
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_to_file, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_to_file, 0, 0, 1)
ZEND_ARG_INFO(0, filename) ZEND_ARG_INFO(0, filename)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_to_stream, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_to_stream, 0, 0, 1)
ZEND_ARG_INFO(0, stream) ZEND_ARG_INFO(0, stream)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
#define arginfo_aws_crt_log_stop arginfo_aws_crt_log_to_stdout #define arginfo_aws_crt_log_stop arginfo_aws_crt_log_to_stdout
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_set_level, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_set_level, 0, 0, 1)
ZEND_ARG_INFO(0, level) ZEND_ARG_INFO(0, level)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_message, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_message, 0, 0, 1)
ZEND_ARG_INFO(0, message) ZEND_ARG_INFO(0, message)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
#define arginfo_aws_crt_event_loop_group_options_new arginfo_aws_crt_last_error #define arginfo_aws_crt_event_loop_group_options_new arginfo_aws_crt_last_error
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_event_loop_group_options_release, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_event_loop_group_options_release, 0, 0, 1)
ZEND_ARG_INFO(0, elg_options) ZEND_ARG_INFO(0, elg_options)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_event_loop_group_options_set_max_threads, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_event_loop_group_options_set_max_threads, 0, 0, 2)
ZEND_ARG_INFO(0, elg_options) ZEND_ARG_INFO(0, elg_options)
ZEND_ARG_INFO(0, max_threads) ZEND_ARG_INFO(0, max_threads)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_event_loop_group_new, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_event_loop_group_new, 0, 0, 1)
ZEND_ARG_INFO(0, options) ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_event_loop_group_release, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_event_loop_group_release, 0, 0, 1)
ZEND_ARG_INFO(0, event_loop_group) ZEND_ARG_INFO(0, event_loop_group)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_options_new, 0, 0, 0) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_options_new, 0, 0, 0)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_options_release, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_options_release, 0, 0, 1)
ZEND_ARG_INFO(0, options) ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_options_set_user_data, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_options_set_user_data, 0, 0, 2)
ZEND_ARG_INFO(0, options) ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, user_data) ZEND_ARG_INFO(0, user_data)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
#define arginfo_aws_crt_input_stream_new arginfo_aws_crt_event_loop_group_new #define arginfo_aws_crt_input_stream_new arginfo_aws_crt_event_loop_group_new
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_release, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_release, 0, 0, 1)
ZEND_ARG_INFO(0, stream) ZEND_ARG_INFO(0, stream)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_seek, 0, 0, 3) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_seek, 0, 0, 3)
ZEND_ARG_INFO(0, stream) ZEND_ARG_INFO(0, stream)
ZEND_ARG_INFO(0, offset) ZEND_ARG_INFO(0, offset)
ZEND_ARG_INFO(0, basis) ZEND_ARG_INFO(0, basis)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_read, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_read, 0, 0, 2)
ZEND_ARG_INFO(0, stream) ZEND_ARG_INFO(0, stream)
ZEND_ARG_INFO(0, length) ZEND_ARG_INFO(0, length)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_eof, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_eof, 0, 0, 1)
ZEND_ARG_INFO(0, stream) ZEND_ARG_INFO(0, stream)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_get_length, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_get_length, 0, 0, 1)
ZEND_ARG_INFO(0, stream) ZEND_ARG_INFO(0, stream)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_http_message_new_from_blob, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_http_message_new_from_blob, 0, 0, 1)
ZEND_ARG_INFO(0, blob) ZEND_ARG_INFO(0, blob)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_http_message_to_blob, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_http_message_to_blob, 0, 0, 1)
ZEND_ARG_INFO(0, message) ZEND_ARG_INFO(0, message)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_http_message_release, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_http_message_release, 0, 0, 1)
ZEND_ARG_INFO(0, message) ZEND_ARG_INFO(0, message)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
#define arginfo_aws_crt_credentials_options_new arginfo_aws_crt_input_stream_options_new #define arginfo_aws_crt_credentials_options_new arginfo_aws_crt_input_stream_options_new
#define arginfo_aws_crt_credentials_options_release arginfo_aws_crt_input_stream_options_release #define arginfo_aws_crt_credentials_options_release arginfo_aws_crt_input_stream_options_release
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_options_set_access_key_id, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_options_set_access_key_id, 0, 0, 2)
ZEND_ARG_INFO(0, options) ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, access_key_id) ZEND_ARG_INFO(0, access_key_id)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_options_set_secret_access_key, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_options_set_secret_access_key, 0, 0, 2)
ZEND_ARG_INFO(0, options) ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, secret_access_key) ZEND_ARG_INFO(0, secret_access_key)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_options_set_session_token, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_options_set_session_token, 0, 0, 2)
ZEND_ARG_INFO(0, options) ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, session_token) ZEND_ARG_INFO(0, session_token)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_options_set_expiration_timepoint_seconds, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_options_set_expiration_timepoint_seconds, 0, 0, 2)
ZEND_ARG_INFO(0, options) ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, expiration_timepoint_seconds) ZEND_ARG_INFO(0, expiration_timepoint_seconds)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
#define arginfo_aws_crt_credentials_new arginfo_aws_crt_event_loop_group_new #define arginfo_aws_crt_credentials_new arginfo_aws_crt_event_loop_group_new
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_release, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_release, 0, 0, 1)
ZEND_ARG_INFO(0, credentials) ZEND_ARG_INFO(0, credentials)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_provider_release, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_provider_release, 0, 0, 1)
ZEND_ARG_INFO(0, credentials) ZEND_ARG_INFO(0, credentials)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
#define arginfo_aws_crt_credentials_provider_static_options_new arginfo_aws_crt_input_stream_options_new #define arginfo_aws_crt_credentials_provider_static_options_new arginfo_aws_crt_input_stream_options_new
#define arginfo_aws_crt_credentials_provider_static_options_release arginfo_aws_crt_input_stream_options_release #define arginfo_aws_crt_credentials_provider_static_options_release arginfo_aws_crt_input_stream_options_release
#define arginfo_aws_crt_credentials_provider_static_options_set_access_key_id arginfo_aws_crt_credentials_options_set_access_key_id #define arginfo_aws_crt_credentials_provider_static_options_set_access_key_id arginfo_aws_crt_credentials_options_set_access_key_id
#define arginfo_aws_crt_credentials_provider_static_options_set_secret_access_key arginfo_aws_crt_credentials_options_set_secret_access_key #define arginfo_aws_crt_credentials_provider_static_options_set_secret_access_key arginfo_aws_crt_credentials_options_set_secret_access_key
#define arginfo_aws_crt_credentials_provider_static_options_set_session_token arginfo_aws_crt_credentials_options_set_session_token #define arginfo_aws_crt_credentials_provider_static_options_set_session_token arginfo_aws_crt_credentials_options_set_session_token
#define arginfo_aws_crt_credentials_provider_static_new arginfo_aws_crt_event_loop_group_new #define arginfo_aws_crt_credentials_provider_static_new arginfo_aws_crt_event_loop_group_new
#define arginfo_aws_crt_signing_config_aws_new arginfo_aws_crt_last_error #define arginfo_aws_crt_signing_config_aws_new arginfo_aws_crt_last_error
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_release, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_release, 0, 0, 1)
ZEND_ARG_INFO(0, config) ZEND_ARG_INFO(0, config)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_algorithm, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_algorithm, 0, 0, 2)
ZEND_ARG_INFO(0, config) ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, algorithm) ZEND_ARG_INFO(0, algorithm)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_signature_type, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_signature_type, 0, 0, 2)
ZEND_ARG_INFO(0, config) ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, signature_type) ZEND_ARG_INFO(0, signature_type)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_credentials_provider, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_credentials_provider, 0, 0, 2)
ZEND_ARG_INFO(0, config) ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, credentials_provider) ZEND_ARG_INFO(0, credentials_provider)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_region, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_region, 0, 0, 2)
ZEND_ARG_INFO(0, config) ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, region) ZEND_ARG_INFO(0, region)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_service, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_service, 0, 0, 2)
ZEND_ARG_INFO(0, config) ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, service) ZEND_ARG_INFO(0, service)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_use_double_uri_encode, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_use_double_uri_encode, 0, 0, 2)
ZEND_ARG_INFO(0, config) ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, use_double_uri_encode) ZEND_ARG_INFO(0, use_double_uri_encode)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_should_normalize_uri_path, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_should_normalize_uri_path, 0, 0, 2)
ZEND_ARG_INFO(0, config) ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, should_normalize_uri_path) ZEND_ARG_INFO(0, should_normalize_uri_path)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_omit_session_token, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_omit_session_token, 0, 0, 2)
ZEND_ARG_INFO(0, config) ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, omit_session_token) ZEND_ARG_INFO(0, omit_session_token)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_signed_body_value, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_signed_body_value, 0, 0, 2)
ZEND_ARG_INFO(0, config) ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, signed_body_value) ZEND_ARG_INFO(0, signed_body_value)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_signed_body_header_type, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_signed_body_header_type, 0, 0, 2)
ZEND_ARG_INFO(0, config) ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, signed_body_header_type) ZEND_ARG_INFO(0, signed_body_header_type)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_expiration_in_seconds, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_expiration_in_seconds, 0, 0, 2)
ZEND_ARG_INFO(0, config) ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, expiration_in_seconds) ZEND_ARG_INFO(0, expiration_in_seconds)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_date, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_date, 0, 0, 2)
ZEND_ARG_INFO(0, config) ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, timestamp) ZEND_ARG_INFO(0, timestamp)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_should_sign_header_fn, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_should_sign_header_fn, 0, 0, 2)
ZEND_ARG_INFO(0, config) ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, should_sign_header) ZEND_ARG_INFO(0, should_sign_header)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signable_new_from_http_request, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signable_new_from_http_request, 0, 0, 1)
ZEND_ARG_INFO(0, http_message) ZEND_ARG_INFO(0, http_message)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signable_new_from_chunk, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signable_new_from_chunk, 0, 0, 2)
ZEND_ARG_INFO(0, input_stream) ZEND_ARG_INFO(0, input_stream)
ZEND_ARG_INFO(0, previous_signature) ZEND_ARG_INFO(0, previous_signature)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signable_new_from_canonical_request, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signable_new_from_canonical_request, 0, 0, 1)
ZEND_ARG_INFO(0, request) ZEND_ARG_INFO(0, request)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signable_release, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signable_release, 0, 0, 1)
ZEND_ARG_INFO(0, signable) ZEND_ARG_INFO(0, signable)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_result_release, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_result_release, 0, 0, 1)
ZEND_ARG_INFO(0, signing_result) ZEND_ARG_INFO(0, signing_result)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_result_apply_to_http_request, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_result_apply_to_http_request, 0, 0, 2)
ZEND_ARG_INFO(0, signing_result) ZEND_ARG_INFO(0, signing_result)
ZEND_ARG_INFO(0, http_request) ZEND_ARG_INFO(0, http_request)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_sign_request_aws, 0, 0, 4) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_sign_request_aws, 0, 0, 4)
ZEND_ARG_INFO(0, signable) ZEND_ARG_INFO(0, signable)
ZEND_ARG_INFO(0, signing_config) ZEND_ARG_INFO(0, signing_config)
ZEND_ARG_INFO(0, on_complete) ZEND_ARG_INFO(0, on_complete)
ZEND_ARG_INFO(0, user_data) ZEND_ARG_INFO(0, user_data)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_test_verify_sigv4a_signing, 0, 0, 6) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_test_verify_sigv4a_signing, 0, 0, 6)
ZEND_ARG_INFO(0, signable) ZEND_ARG_INFO(0, signable)
ZEND_ARG_INFO(0, signing_config) ZEND_ARG_INFO(0, signing_config)
ZEND_ARG_INFO(0, expected_canonical_request) ZEND_ARG_INFO(0, expected_canonical_request)
ZEND_ARG_INFO(0, signature) ZEND_ARG_INFO(0, signature)
ZEND_ARG_INFO(0, ecc_key_pub_x) ZEND_ARG_INFO(0, ecc_key_pub_x)
ZEND_ARG_INFO(0, ecc_key_pub_y) ZEND_ARG_INFO(0, ecc_key_pub_y)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_crc32, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_crc32, 0, 0, 2)
ZEND_ARG_INFO(0, input) ZEND_ARG_INFO(0, input)
ZEND_ARG_INFO(0, prev) ZEND_ARG_INFO(0, prev)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
#define arginfo_aws_crt_crc32c arginfo_aws_crt_crc32 #define arginfo_aws_crt_crc32c arginfo_aws_crt_crc32
ZEND_FUNCTION(aws_crt_last_error); ZEND_FUNCTION(aws_crt_last_error);
ZEND_FUNCTION(aws_crt_error_name); ZEND_FUNCTION(aws_crt_error_name);
ZEND_FUNCTION(aws_crt_error_str); ZEND_FUNCTION(aws_crt_error_str);
ZEND_FUNCTION(aws_crt_error_debug_str); ZEND_FUNCTION(aws_crt_error_debug_str);
ZEND_FUNCTION(aws_crt_log_to_stdout); ZEND_FUNCTION(aws_crt_log_to_stdout);
ZEND_FUNCTION(aws_crt_log_to_stderr); ZEND_FUNCTION(aws_crt_log_to_stderr);
ZEND_FUNCTION(aws_crt_log_to_file); ZEND_FUNCTION(aws_crt_log_to_file);
ZEND_FUNCTION(aws_crt_log_to_stream); ZEND_FUNCTION(aws_crt_log_to_stream);
ZEND_FUNCTION(aws_crt_log_stop); ZEND_FUNCTION(aws_crt_log_stop);
ZEND_FUNCTION(aws_crt_log_set_level); ZEND_FUNCTION(aws_crt_log_set_level);
ZEND_FUNCTION(aws_crt_log_message); ZEND_FUNCTION(aws_crt_log_message);
ZEND_FUNCTION(aws_crt_event_loop_group_options_new); ZEND_FUNCTION(aws_crt_event_loop_group_options_new);
ZEND_FUNCTION(aws_crt_event_loop_group_options_release); ZEND_FUNCTION(aws_crt_event_loop_group_options_release);
ZEND_FUNCTION(aws_crt_event_loop_group_options_set_max_threads); ZEND_FUNCTION(aws_crt_event_loop_group_options_set_max_threads);
ZEND_FUNCTION(aws_crt_event_loop_group_new); ZEND_FUNCTION(aws_crt_event_loop_group_new);
ZEND_FUNCTION(aws_crt_event_loop_group_release); ZEND_FUNCTION(aws_crt_event_loop_group_release);
ZEND_FUNCTION(aws_crt_input_stream_options_new); ZEND_FUNCTION(aws_crt_input_stream_options_new);
ZEND_FUNCTION(aws_crt_input_stream_options_release); ZEND_FUNCTION(aws_crt_input_stream_options_release);
ZEND_FUNCTION(aws_crt_input_stream_options_set_user_data); ZEND_FUNCTION(aws_crt_input_stream_options_set_user_data);
ZEND_FUNCTION(aws_crt_input_stream_new); ZEND_FUNCTION(aws_crt_input_stream_new);
ZEND_FUNCTION(aws_crt_input_stream_release); ZEND_FUNCTION(aws_crt_input_stream_release);
ZEND_FUNCTION(aws_crt_input_stream_seek); ZEND_FUNCTION(aws_crt_input_stream_seek);
ZEND_FUNCTION(aws_crt_input_stream_read); ZEND_FUNCTION(aws_crt_input_stream_read);
ZEND_FUNCTION(aws_crt_input_stream_eof); ZEND_FUNCTION(aws_crt_input_stream_eof);
ZEND_FUNCTION(aws_crt_input_stream_get_length); ZEND_FUNCTION(aws_crt_input_stream_get_length);
ZEND_FUNCTION(aws_crt_http_message_new_from_blob); ZEND_FUNCTION(aws_crt_http_message_new_from_blob);
ZEND_FUNCTION(aws_crt_http_message_to_blob); ZEND_FUNCTION(aws_crt_http_message_to_blob);
ZEND_FUNCTION(aws_crt_http_message_release); ZEND_FUNCTION(aws_crt_http_message_release);
ZEND_FUNCTION(aws_crt_credentials_options_new); ZEND_FUNCTION(aws_crt_credentials_options_new);
ZEND_FUNCTION(aws_crt_credentials_options_release); ZEND_FUNCTION(aws_crt_credentials_options_release);
ZEND_FUNCTION(aws_crt_credentials_options_set_access_key_id); ZEND_FUNCTION(aws_crt_credentials_options_set_access_key_id);
ZEND_FUNCTION(aws_crt_credentials_options_set_secret_access_key); ZEND_FUNCTION(aws_crt_credentials_options_set_secret_access_key);
ZEND_FUNCTION(aws_crt_credentials_options_set_session_token); ZEND_FUNCTION(aws_crt_credentials_options_set_session_token);
ZEND_FUNCTION(aws_crt_credentials_options_set_expiration_timepoint_seconds); ZEND_FUNCTION(aws_crt_credentials_options_set_expiration_timepoint_seconds);
ZEND_FUNCTION(aws_crt_credentials_new); ZEND_FUNCTION(aws_crt_credentials_new);
ZEND_FUNCTION(aws_crt_credentials_release); ZEND_FUNCTION(aws_crt_credentials_release);
ZEND_FUNCTION(aws_crt_credentials_provider_release); ZEND_FUNCTION(aws_crt_credentials_provider_release);
ZEND_FUNCTION(aws_crt_credentials_provider_static_options_new); ZEND_FUNCTION(aws_crt_credentials_provider_static_options_new);
ZEND_FUNCTION(aws_crt_credentials_provider_static_options_release); ZEND_FUNCTION(aws_crt_credentials_provider_static_options_release);
ZEND_FUNCTION(aws_crt_credentials_provider_static_options_set_access_key_id); ZEND_FUNCTION(aws_crt_credentials_provider_static_options_set_access_key_id);
ZEND_FUNCTION(aws_crt_credentials_provider_static_options_set_secret_access_key); ZEND_FUNCTION(aws_crt_credentials_provider_static_options_set_secret_access_key);
ZEND_FUNCTION(aws_crt_credentials_provider_static_options_set_session_token); ZEND_FUNCTION(aws_crt_credentials_provider_static_options_set_session_token);
ZEND_FUNCTION(aws_crt_credentials_provider_static_new); ZEND_FUNCTION(aws_crt_credentials_provider_static_new);
ZEND_FUNCTION(aws_crt_signing_config_aws_new); ZEND_FUNCTION(aws_crt_signing_config_aws_new);
ZEND_FUNCTION(aws_crt_signing_config_aws_release); ZEND_FUNCTION(aws_crt_signing_config_aws_release);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_algorithm); ZEND_FUNCTION(aws_crt_signing_config_aws_set_algorithm);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_signature_type); ZEND_FUNCTION(aws_crt_signing_config_aws_set_signature_type);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_credentials_provider); ZEND_FUNCTION(aws_crt_signing_config_aws_set_credentials_provider);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_region); ZEND_FUNCTION(aws_crt_signing_config_aws_set_region);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_service); ZEND_FUNCTION(aws_crt_signing_config_aws_set_service);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_use_double_uri_encode); ZEND_FUNCTION(aws_crt_signing_config_aws_set_use_double_uri_encode);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_should_normalize_uri_path); ZEND_FUNCTION(aws_crt_signing_config_aws_set_should_normalize_uri_path);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_omit_session_token); ZEND_FUNCTION(aws_crt_signing_config_aws_set_omit_session_token);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_signed_body_value); ZEND_FUNCTION(aws_crt_signing_config_aws_set_signed_body_value);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_signed_body_header_type); ZEND_FUNCTION(aws_crt_signing_config_aws_set_signed_body_header_type);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_expiration_in_seconds); ZEND_FUNCTION(aws_crt_signing_config_aws_set_expiration_in_seconds);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_date); ZEND_FUNCTION(aws_crt_signing_config_aws_set_date);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_should_sign_header_fn); ZEND_FUNCTION(aws_crt_signing_config_aws_set_should_sign_header_fn);
ZEND_FUNCTION(aws_crt_signable_new_from_http_request); ZEND_FUNCTION(aws_crt_signable_new_from_http_request);
ZEND_FUNCTION(aws_crt_signable_new_from_chunk); ZEND_FUNCTION(aws_crt_signable_new_from_chunk);
ZEND_FUNCTION(aws_crt_signable_new_from_canonical_request); ZEND_FUNCTION(aws_crt_signable_new_from_canonical_request);
ZEND_FUNCTION(aws_crt_signable_release); ZEND_FUNCTION(aws_crt_signable_release);
ZEND_FUNCTION(aws_crt_signing_result_release); ZEND_FUNCTION(aws_crt_signing_result_release);
ZEND_FUNCTION(aws_crt_signing_result_apply_to_http_request); ZEND_FUNCTION(aws_crt_signing_result_apply_to_http_request);
ZEND_FUNCTION(aws_crt_sign_request_aws); ZEND_FUNCTION(aws_crt_sign_request_aws);
ZEND_FUNCTION(aws_crt_test_verify_sigv4a_signing); ZEND_FUNCTION(aws_crt_test_verify_sigv4a_signing);
ZEND_FUNCTION(aws_crt_crc32); ZEND_FUNCTION(aws_crt_crc32);
ZEND_FUNCTION(aws_crt_crc32c); ZEND_FUNCTION(aws_crt_crc32c);
static const zend_function_entry ext_functions[] = { static const zend_function_entry ext_functions[] = {
ZEND_FE(aws_crt_last_error, arginfo_aws_crt_last_error) ZEND_FE(aws_crt_last_error, arginfo_aws_crt_last_error)
ZEND_FE(aws_crt_error_name, arginfo_aws_crt_error_name) ZEND_FE(aws_crt_error_name, arginfo_aws_crt_error_name)
ZEND_FE(aws_crt_error_str, arginfo_aws_crt_error_str) ZEND_FE(aws_crt_error_str, arginfo_aws_crt_error_str)
ZEND_FE(aws_crt_error_debug_str, arginfo_aws_crt_error_debug_str) ZEND_FE(aws_crt_error_debug_str, arginfo_aws_crt_error_debug_str)
ZEND_FE(aws_crt_log_to_stdout, arginfo_aws_crt_log_to_stdout) ZEND_FE(aws_crt_log_to_stdout, arginfo_aws_crt_log_to_stdout)
ZEND_FE(aws_crt_log_to_stderr, arginfo_aws_crt_log_to_stderr) ZEND_FE(aws_crt_log_to_stderr, arginfo_aws_crt_log_to_stderr)
ZEND_FE(aws_crt_log_to_file, arginfo_aws_crt_log_to_file) ZEND_FE(aws_crt_log_to_file, arginfo_aws_crt_log_to_file)
ZEND_FE(aws_crt_log_to_stream, arginfo_aws_crt_log_to_stream) ZEND_FE(aws_crt_log_to_stream, arginfo_aws_crt_log_to_stream)
ZEND_FE(aws_crt_log_stop, arginfo_aws_crt_log_stop) ZEND_FE(aws_crt_log_stop, arginfo_aws_crt_log_stop)
ZEND_FE(aws_crt_log_set_level, arginfo_aws_crt_log_set_level) ZEND_FE(aws_crt_log_set_level, arginfo_aws_crt_log_set_level)
ZEND_FE(aws_crt_log_message, arginfo_aws_crt_log_message) ZEND_FE(aws_crt_log_message, arginfo_aws_crt_log_message)
ZEND_FE(aws_crt_event_loop_group_options_new, arginfo_aws_crt_event_loop_group_options_new) ZEND_FE(aws_crt_event_loop_group_options_new, arginfo_aws_crt_event_loop_group_options_new)
ZEND_FE(aws_crt_event_loop_group_options_release, arginfo_aws_crt_event_loop_group_options_release) ZEND_FE(aws_crt_event_loop_group_options_release, arginfo_aws_crt_event_loop_group_options_release)
ZEND_FE(aws_crt_event_loop_group_options_set_max_threads, arginfo_aws_crt_event_loop_group_options_set_max_threads) ZEND_FE(aws_crt_event_loop_group_options_set_max_threads, arginfo_aws_crt_event_loop_group_options_set_max_threads)
ZEND_FE(aws_crt_event_loop_group_new, arginfo_aws_crt_event_loop_group_new) ZEND_FE(aws_crt_event_loop_group_new, arginfo_aws_crt_event_loop_group_new)
ZEND_FE(aws_crt_event_loop_group_release, arginfo_aws_crt_event_loop_group_release) ZEND_FE(aws_crt_event_loop_group_release, arginfo_aws_crt_event_loop_group_release)
ZEND_FE(aws_crt_input_stream_options_new, arginfo_aws_crt_input_stream_options_new) ZEND_FE(aws_crt_input_stream_options_new, arginfo_aws_crt_input_stream_options_new)
ZEND_FE(aws_crt_input_stream_options_release, arginfo_aws_crt_input_stream_options_release) ZEND_FE(aws_crt_input_stream_options_release, arginfo_aws_crt_input_stream_options_release)
ZEND_FE(aws_crt_input_stream_options_set_user_data, arginfo_aws_crt_input_stream_options_set_user_data) ZEND_FE(aws_crt_input_stream_options_set_user_data, arginfo_aws_crt_input_stream_options_set_user_data)
ZEND_FE(aws_crt_input_stream_new, arginfo_aws_crt_input_stream_new) ZEND_FE(aws_crt_input_stream_new, arginfo_aws_crt_input_stream_new)
ZEND_FE(aws_crt_input_stream_release, arginfo_aws_crt_input_stream_release) ZEND_FE(aws_crt_input_stream_release, arginfo_aws_crt_input_stream_release)
ZEND_FE(aws_crt_input_stream_seek, arginfo_aws_crt_input_stream_seek) ZEND_FE(aws_crt_input_stream_seek, arginfo_aws_crt_input_stream_seek)
ZEND_FE(aws_crt_input_stream_read, arginfo_aws_crt_input_stream_read) ZEND_FE(aws_crt_input_stream_read, arginfo_aws_crt_input_stream_read)
ZEND_FE(aws_crt_input_stream_eof, arginfo_aws_crt_input_stream_eof) ZEND_FE(aws_crt_input_stream_eof, arginfo_aws_crt_input_stream_eof)
ZEND_FE(aws_crt_input_stream_get_length, arginfo_aws_crt_input_stream_get_length) ZEND_FE(aws_crt_input_stream_get_length, arginfo_aws_crt_input_stream_get_length)
ZEND_FE(aws_crt_http_message_new_from_blob, arginfo_aws_crt_http_message_new_from_blob) ZEND_FE(aws_crt_http_message_new_from_blob, arginfo_aws_crt_http_message_new_from_blob)
ZEND_FE(aws_crt_http_message_to_blob, arginfo_aws_crt_http_message_to_blob) ZEND_FE(aws_crt_http_message_to_blob, arginfo_aws_crt_http_message_to_blob)
ZEND_FE(aws_crt_http_message_release, arginfo_aws_crt_http_message_release) ZEND_FE(aws_crt_http_message_release, arginfo_aws_crt_http_message_release)
ZEND_FE(aws_crt_credentials_options_new, arginfo_aws_crt_credentials_options_new) ZEND_FE(aws_crt_credentials_options_new, arginfo_aws_crt_credentials_options_new)
ZEND_FE(aws_crt_credentials_options_release, arginfo_aws_crt_credentials_options_release) ZEND_FE(aws_crt_credentials_options_release, arginfo_aws_crt_credentials_options_release)
ZEND_FE(aws_crt_credentials_options_set_access_key_id, arginfo_aws_crt_credentials_options_set_access_key_id) ZEND_FE(aws_crt_credentials_options_set_access_key_id, arginfo_aws_crt_credentials_options_set_access_key_id)
ZEND_FE(aws_crt_credentials_options_set_secret_access_key, arginfo_aws_crt_credentials_options_set_secret_access_key) ZEND_FE(aws_crt_credentials_options_set_secret_access_key, arginfo_aws_crt_credentials_options_set_secret_access_key)
ZEND_FE(aws_crt_credentials_options_set_session_token, arginfo_aws_crt_credentials_options_set_session_token) ZEND_FE(aws_crt_credentials_options_set_session_token, arginfo_aws_crt_credentials_options_set_session_token)
ZEND_FE(aws_crt_credentials_options_set_expiration_timepoint_seconds, arginfo_aws_crt_credentials_options_set_expiration_timepoint_seconds) ZEND_FE(aws_crt_credentials_options_set_expiration_timepoint_seconds, arginfo_aws_crt_credentials_options_set_expiration_timepoint_seconds)
ZEND_FE(aws_crt_credentials_new, arginfo_aws_crt_credentials_new) ZEND_FE(aws_crt_credentials_new, arginfo_aws_crt_credentials_new)
ZEND_FE(aws_crt_credentials_release, arginfo_aws_crt_credentials_release) ZEND_FE(aws_crt_credentials_release, arginfo_aws_crt_credentials_release)
ZEND_FE(aws_crt_credentials_provider_release, arginfo_aws_crt_credentials_provider_release) ZEND_FE(aws_crt_credentials_provider_release, arginfo_aws_crt_credentials_provider_release)
ZEND_FE(aws_crt_credentials_provider_static_options_new, arginfo_aws_crt_credentials_provider_static_options_new) ZEND_FE(aws_crt_credentials_provider_static_options_new, arginfo_aws_crt_credentials_provider_static_options_new)
ZEND_FE(aws_crt_credentials_provider_static_options_release, arginfo_aws_crt_credentials_provider_static_options_release) ZEND_FE(aws_crt_credentials_provider_static_options_release, arginfo_aws_crt_credentials_provider_static_options_release)
ZEND_FE(aws_crt_credentials_provider_static_options_set_access_key_id, arginfo_aws_crt_credentials_provider_static_options_set_access_key_id) ZEND_FE(aws_crt_credentials_provider_static_options_set_access_key_id, arginfo_aws_crt_credentials_provider_static_options_set_access_key_id)
ZEND_FE(aws_crt_credentials_provider_static_options_set_secret_access_key, arginfo_aws_crt_credentials_provider_static_options_set_secret_access_key) ZEND_FE(aws_crt_credentials_provider_static_options_set_secret_access_key, arginfo_aws_crt_credentials_provider_static_options_set_secret_access_key)
ZEND_FE(aws_crt_credentials_provider_static_options_set_session_token, arginfo_aws_crt_credentials_provider_static_options_set_session_token) ZEND_FE(aws_crt_credentials_provider_static_options_set_session_token, arginfo_aws_crt_credentials_provider_static_options_set_session_token)
ZEND_FE(aws_crt_credentials_provider_static_new, arginfo_aws_crt_credentials_provider_static_new) ZEND_FE(aws_crt_credentials_provider_static_new, arginfo_aws_crt_credentials_provider_static_new)
ZEND_FE(aws_crt_signing_config_aws_new, arginfo_aws_crt_signing_config_aws_new) ZEND_FE(aws_crt_signing_config_aws_new, arginfo_aws_crt_signing_config_aws_new)
ZEND_FE(aws_crt_signing_config_aws_release, arginfo_aws_crt_signing_config_aws_release) ZEND_FE(aws_crt_signing_config_aws_release, arginfo_aws_crt_signing_config_aws_release)
ZEND_FE(aws_crt_signing_config_aws_set_algorithm, arginfo_aws_crt_signing_config_aws_set_algorithm) ZEND_FE(aws_crt_signing_config_aws_set_algorithm, arginfo_aws_crt_signing_config_aws_set_algorithm)
ZEND_FE(aws_crt_signing_config_aws_set_signature_type, arginfo_aws_crt_signing_config_aws_set_signature_type) ZEND_FE(aws_crt_signing_config_aws_set_signature_type, arginfo_aws_crt_signing_config_aws_set_signature_type)
ZEND_FE(aws_crt_signing_config_aws_set_credentials_provider, arginfo_aws_crt_signing_config_aws_set_credentials_provider) ZEND_FE(aws_crt_signing_config_aws_set_credentials_provider, arginfo_aws_crt_signing_config_aws_set_credentials_provider)
ZEND_FE(aws_crt_signing_config_aws_set_region, arginfo_aws_crt_signing_config_aws_set_region) ZEND_FE(aws_crt_signing_config_aws_set_region, arginfo_aws_crt_signing_config_aws_set_region)
ZEND_FE(aws_crt_signing_config_aws_set_service, arginfo_aws_crt_signing_config_aws_set_service) ZEND_FE(aws_crt_signing_config_aws_set_service, arginfo_aws_crt_signing_config_aws_set_service)
ZEND_FE(aws_crt_signing_config_aws_set_use_double_uri_encode, arginfo_aws_crt_signing_config_aws_set_use_double_uri_encode) ZEND_FE(aws_crt_signing_config_aws_set_use_double_uri_encode, arginfo_aws_crt_signing_config_aws_set_use_double_uri_encode)
ZEND_FE(aws_crt_signing_config_aws_set_should_normalize_uri_path, arginfo_aws_crt_signing_config_aws_set_should_normalize_uri_path) ZEND_FE(aws_crt_signing_config_aws_set_should_normalize_uri_path, arginfo_aws_crt_signing_config_aws_set_should_normalize_uri_path)
ZEND_FE(aws_crt_signing_config_aws_set_omit_session_token, arginfo_aws_crt_signing_config_aws_set_omit_session_token) ZEND_FE(aws_crt_signing_config_aws_set_omit_session_token, arginfo_aws_crt_signing_config_aws_set_omit_session_token)
ZEND_FE(aws_crt_signing_config_aws_set_signed_body_value, arginfo_aws_crt_signing_config_aws_set_signed_body_value) ZEND_FE(aws_crt_signing_config_aws_set_signed_body_value, arginfo_aws_crt_signing_config_aws_set_signed_body_value)
ZEND_FE(aws_crt_signing_config_aws_set_signed_body_header_type, arginfo_aws_crt_signing_config_aws_set_signed_body_header_type) ZEND_FE(aws_crt_signing_config_aws_set_signed_body_header_type, arginfo_aws_crt_signing_config_aws_set_signed_body_header_type)
ZEND_FE(aws_crt_signing_config_aws_set_expiration_in_seconds, arginfo_aws_crt_signing_config_aws_set_expiration_in_seconds) ZEND_FE(aws_crt_signing_config_aws_set_expiration_in_seconds, arginfo_aws_crt_signing_config_aws_set_expiration_in_seconds)
ZEND_FE(aws_crt_signing_config_aws_set_date, arginfo_aws_crt_signing_config_aws_set_date) ZEND_FE(aws_crt_signing_config_aws_set_date, arginfo_aws_crt_signing_config_aws_set_date)
ZEND_FE(aws_crt_signing_config_aws_set_should_sign_header_fn, arginfo_aws_crt_signing_config_aws_set_should_sign_header_fn) ZEND_FE(aws_crt_signing_config_aws_set_should_sign_header_fn, arginfo_aws_crt_signing_config_aws_set_should_sign_header_fn)
ZEND_FE(aws_crt_signable_new_from_http_request, arginfo_aws_crt_signable_new_from_http_request) ZEND_FE(aws_crt_signable_new_from_http_request, arginfo_aws_crt_signable_new_from_http_request)
ZEND_FE(aws_crt_signable_new_from_chunk, arginfo_aws_crt_signable_new_from_chunk) ZEND_FE(aws_crt_signable_new_from_chunk, arginfo_aws_crt_signable_new_from_chunk)
ZEND_FE(aws_crt_signable_new_from_canonical_request, arginfo_aws_crt_signable_new_from_canonical_request) ZEND_FE(aws_crt_signable_new_from_canonical_request, arginfo_aws_crt_signable_new_from_canonical_request)
ZEND_FE(aws_crt_signable_release, arginfo_aws_crt_signable_release) ZEND_FE(aws_crt_signable_release, arginfo_aws_crt_signable_release)
ZEND_FE(aws_crt_signing_result_release, arginfo_aws_crt_signing_result_release) ZEND_FE(aws_crt_signing_result_release, arginfo_aws_crt_signing_result_release)
ZEND_FE(aws_crt_signing_result_apply_to_http_request, arginfo_aws_crt_signing_result_apply_to_http_request) ZEND_FE(aws_crt_signing_result_apply_to_http_request, arginfo_aws_crt_signing_result_apply_to_http_request)
ZEND_FE(aws_crt_sign_request_aws, arginfo_aws_crt_sign_request_aws) ZEND_FE(aws_crt_sign_request_aws, arginfo_aws_crt_sign_request_aws)
ZEND_FE(aws_crt_test_verify_sigv4a_signing, arginfo_aws_crt_test_verify_sigv4a_signing) ZEND_FE(aws_crt_test_verify_sigv4a_signing, arginfo_aws_crt_test_verify_sigv4a_signing)
ZEND_FE(aws_crt_crc32, arginfo_aws_crt_crc32) ZEND_FE(aws_crt_crc32, arginfo_aws_crt_crc32)
ZEND_FE(aws_crt_crc32c, arginfo_aws_crt_crc32c) ZEND_FE(aws_crt_crc32c, arginfo_aws_crt_crc32c)
ZEND_FE_END ZEND_FE_END
}; };

View file

@ -1,32 +1,32 @@
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
#include "php_aws_crt.h" #include "php_aws_crt.h"
PHP_FUNCTION(aws_crt_crc32) { PHP_FUNCTION(aws_crt_crc32) {
zend_ulong prev = 0; zend_ulong prev = 0;
const char *input = NULL; const char *input = NULL;
size_t len = 0; size_t len = 0;
aws_php_parse_parameters("sl", &input, &len, &prev); aws_php_parse_parameters("sl", &input, &len, &prev);
if (prev > UINT32_MAX) { if (prev > UINT32_MAX) {
aws_php_throw_exception("previous crc cannot be larger than UINT32_MAX"); aws_php_throw_exception("previous crc cannot be larger than UINT32_MAX");
} }
RETURN_LONG((zend_ulong)aws_crt_crc32((const uint8_t *)input, len, prev)); RETURN_LONG((zend_ulong)aws_crt_crc32((const uint8_t *)input, len, prev));
} }
PHP_FUNCTION(aws_crt_crc32c) { PHP_FUNCTION(aws_crt_crc32c) {
zend_ulong prev = 0; zend_ulong prev = 0;
const char *input = NULL; const char *input = NULL;
size_t len = 0; size_t len = 0;
aws_php_parse_parameters("sl", &input, &len, &prev); aws_php_parse_parameters("sl", &input, &len, &prev);
if (prev > UINT32_MAX) { if (prev > UINT32_MAX) {
aws_php_throw_exception("previous crc cannot be larger than UINT32_MAX"); aws_php_throw_exception("previous crc cannot be larger than UINT32_MAX");
} }
RETURN_LONG((zend_ulong)aws_crt_crc32c((const uint8_t *)input, len, prev)); RETURN_LONG((zend_ulong)aws_crt_crc32c((const uint8_t *)input, len, prev));
} }

View file

@ -1,154 +1,154 @@
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
#include "php_aws_crt.h" #include "php_aws_crt.h"
PHP_FUNCTION(aws_crt_credentials_options_new) { PHP_FUNCTION(aws_crt_credentials_options_new) {
aws_crt_credentials_options *options = aws_crt_credentials_options_new(); aws_crt_credentials_options *options = aws_crt_credentials_options_new();
RETURN_LONG((zend_ulong)options); RETURN_LONG((zend_ulong)options);
} }
PHP_FUNCTION(aws_crt_credentials_options_release) { PHP_FUNCTION(aws_crt_credentials_options_release) {
zend_ulong php_options = 0; zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options); aws_php_parse_parameters("l", &php_options);
aws_crt_credentials_options *options = (void *)php_options; aws_crt_credentials_options *options = (void *)php_options;
aws_crt_credentials_options_release(options); aws_crt_credentials_options_release(options);
} }
PHP_FUNCTION(aws_crt_credentials_options_set_access_key_id) { PHP_FUNCTION(aws_crt_credentials_options_set_access_key_id) {
zend_ulong php_options = 0; zend_ulong php_options = 0;
const char *access_key_id = NULL; const char *access_key_id = NULL;
size_t access_key_id_len = 0; size_t access_key_id_len = 0;
aws_php_parse_parameters("ls", &php_options, &access_key_id, &access_key_id_len); aws_php_parse_parameters("ls", &php_options, &access_key_id, &access_key_id_len);
aws_crt_credentials_options *options = (void *)php_options; aws_crt_credentials_options *options = (void *)php_options;
aws_crt_credentials_options_set_access_key_id(options, (uint8_t *)access_key_id, access_key_id_len); aws_crt_credentials_options_set_access_key_id(options, (uint8_t *)access_key_id, access_key_id_len);
} }
PHP_FUNCTION(aws_crt_credentials_options_set_secret_access_key) { PHP_FUNCTION(aws_crt_credentials_options_set_secret_access_key) {
zend_ulong php_options = 0; zend_ulong php_options = 0;
const char *secret_access_key = NULL; const char *secret_access_key = NULL;
size_t secret_access_key_len = 0; size_t secret_access_key_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &php_options, &secret_access_key, &secret_access_key_len) == if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &php_options, &secret_access_key, &secret_access_key_len) ==
FAILURE) { FAILURE) {
RETURN_NULL(); RETURN_NULL();
} }
aws_crt_credentials_options *options = (void *)php_options; aws_crt_credentials_options *options = (void *)php_options;
aws_crt_credentials_options_set_secret_access_key(options, (uint8_t *)secret_access_key, secret_access_key_len); aws_crt_credentials_options_set_secret_access_key(options, (uint8_t *)secret_access_key, secret_access_key_len);
} }
PHP_FUNCTION(aws_crt_credentials_options_set_session_token) { PHP_FUNCTION(aws_crt_credentials_options_set_session_token) {
zend_ulong php_options = 0; zend_ulong php_options = 0;
const char *session_token = NULL; const char *session_token = NULL;
size_t session_token_len = 0; size_t session_token_len = 0;
aws_php_parse_parameters("ls", &php_options, &session_token, &session_token_len); aws_php_parse_parameters("ls", &php_options, &session_token, &session_token_len);
aws_crt_credentials_options *options = (void *)php_options; aws_crt_credentials_options *options = (void *)php_options;
aws_crt_credentials_options_set_session_token(options, (uint8_t *)session_token, session_token_len); aws_crt_credentials_options_set_session_token(options, (uint8_t *)session_token, session_token_len);
} }
PHP_FUNCTION(aws_crt_credentials_options_set_expiration_timepoint_seconds) { PHP_FUNCTION(aws_crt_credentials_options_set_expiration_timepoint_seconds) {
zend_ulong php_options = 0; zend_ulong php_options = 0;
zend_ulong expiration_timepoint_seconds = 0; zend_ulong expiration_timepoint_seconds = 0;
aws_php_parse_parameters("ll", &php_options, &expiration_timepoint_seconds); aws_php_parse_parameters("ll", &php_options, &expiration_timepoint_seconds);
aws_crt_credentials_options *options = (void *)php_options; aws_crt_credentials_options *options = (void *)php_options;
aws_crt_credentials_options_set_expiration_timepoint_seconds(options, expiration_timepoint_seconds); aws_crt_credentials_options_set_expiration_timepoint_seconds(options, expiration_timepoint_seconds);
} }
PHP_FUNCTION(aws_crt_credentials_new) { PHP_FUNCTION(aws_crt_credentials_new) {
zend_ulong php_options = 0; zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options); aws_php_parse_parameters("l", &php_options);
aws_crt_credentials_options *options = (void *)php_options; aws_crt_credentials_options *options = (void *)php_options;
aws_crt_credentials *credentials = aws_crt_credentials_new(options); aws_crt_credentials *credentials = aws_crt_credentials_new(options);
RETURN_LONG((zend_ulong)credentials); RETURN_LONG((zend_ulong)credentials);
} }
PHP_FUNCTION(aws_crt_credentials_release) { PHP_FUNCTION(aws_crt_credentials_release) {
zend_ulong php_credentials = 0; zend_ulong php_credentials = 0;
aws_php_parse_parameters("l", &php_credentials); aws_php_parse_parameters("l", &php_credentials);
aws_crt_credentials *credentials = (void *)php_credentials; aws_crt_credentials *credentials = (void *)php_credentials;
aws_crt_credentials_release(credentials); aws_crt_credentials_release(credentials);
} }
PHP_FUNCTION(aws_crt_credentials_provider_release) { PHP_FUNCTION(aws_crt_credentials_provider_release) {
zend_ulong php_creds_provider = 0; zend_ulong php_creds_provider = 0;
aws_php_parse_parameters("l", &php_creds_provider); aws_php_parse_parameters("l", &php_creds_provider);
aws_crt_credentials_provider *provider = (void *)php_creds_provider; aws_crt_credentials_provider *provider = (void *)php_creds_provider;
aws_crt_credentials_provider_release(provider); aws_crt_credentials_provider_release(provider);
} }
PHP_FUNCTION(aws_crt_credentials_provider_static_options_new) { PHP_FUNCTION(aws_crt_credentials_provider_static_options_new) {
aws_crt_credentials_provider_static_options *options = aws_crt_credentials_provider_static_options_new(); aws_crt_credentials_provider_static_options *options = aws_crt_credentials_provider_static_options_new();
RETURN_LONG((zend_ulong)options); RETURN_LONG((zend_ulong)options);
} }
PHP_FUNCTION(aws_crt_credentials_provider_static_options_release) { PHP_FUNCTION(aws_crt_credentials_provider_static_options_release) {
zend_ulong php_options = 0; zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options); aws_php_parse_parameters("l", &php_options);
aws_crt_credentials_provider_static_options *options = (void *)php_options; aws_crt_credentials_provider_static_options *options = (void *)php_options;
aws_crt_credentials_provider_static_options_release(options); aws_crt_credentials_provider_static_options_release(options);
} }
PHP_FUNCTION(aws_crt_credentials_provider_static_options_set_access_key_id) { PHP_FUNCTION(aws_crt_credentials_provider_static_options_set_access_key_id) {
zend_ulong php_options = 0; zend_ulong php_options = 0;
const char *access_key_id = NULL; const char *access_key_id = NULL;
size_t access_key_id_len = 0; size_t access_key_id_len = 0;
aws_php_parse_parameters("ls", &php_options, &access_key_id, &access_key_id_len); aws_php_parse_parameters("ls", &php_options, &access_key_id, &access_key_id_len);
aws_crt_credentials_provider_static_options *options = (void *)php_options; aws_crt_credentials_provider_static_options *options = (void *)php_options;
aws_crt_credentials_provider_static_options_set_access_key_id(options, (uint8_t *)access_key_id, access_key_id_len); aws_crt_credentials_provider_static_options_set_access_key_id(options, (uint8_t *)access_key_id, access_key_id_len);
} }
PHP_FUNCTION(aws_crt_credentials_provider_static_options_set_secret_access_key) { PHP_FUNCTION(aws_crt_credentials_provider_static_options_set_secret_access_key) {
zend_ulong php_options = 0; zend_ulong php_options = 0;
const char *secret_access_key = NULL; const char *secret_access_key = NULL;
size_t secret_access_key_len = 0; size_t secret_access_key_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &php_options, &secret_access_key, &secret_access_key_len) == if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &php_options, &secret_access_key, &secret_access_key_len) ==
FAILURE) { FAILURE) {
RETURN_NULL(); RETURN_NULL();
} }
aws_crt_credentials_provider_static_options *options = (void *)php_options; aws_crt_credentials_provider_static_options *options = (void *)php_options;
aws_crt_credentials_provider_static_options_set_secret_access_key( aws_crt_credentials_provider_static_options_set_secret_access_key(
options, (uint8_t *)secret_access_key, secret_access_key_len); options, (uint8_t *)secret_access_key, secret_access_key_len);
} }
PHP_FUNCTION(aws_crt_credentials_provider_static_options_set_session_token) { PHP_FUNCTION(aws_crt_credentials_provider_static_options_set_session_token) {
zend_ulong php_options = 0; zend_ulong php_options = 0;
const char *session_token = NULL; const char *session_token = NULL;
size_t session_token_len = 0; size_t session_token_len = 0;
aws_php_parse_parameters("ls", &php_options, &session_token, &session_token_len); aws_php_parse_parameters("ls", &php_options, &session_token, &session_token_len);
aws_crt_credentials_provider_static_options *options = (void *)php_options; aws_crt_credentials_provider_static_options *options = (void *)php_options;
aws_crt_credentials_provider_static_options_set_session_token(options, (uint8_t *)session_token, session_token_len); aws_crt_credentials_provider_static_options_set_session_token(options, (uint8_t *)session_token, session_token_len);
} }
PHP_FUNCTION(aws_crt_credentials_provider_static_new) { PHP_FUNCTION(aws_crt_credentials_provider_static_new) {
zend_ulong php_options = 0; zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options); aws_php_parse_parameters("l", &php_options);
aws_crt_credentials_provider_static_options *options = (void *)php_options; aws_crt_credentials_provider_static_options *options = (void *)php_options;
aws_crt_credentials_provider *provider = aws_crt_credentials_provider_static_new(options); aws_crt_credentials_provider *provider = aws_crt_credentials_provider_static_new(options);
RETURN_LONG((zend_ulong)provider); RETURN_LONG((zend_ulong)provider);
} }

View file

@ -1,314 +1,314 @@
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
#include "php_aws_crt.h" #include "php_aws_crt.h"
/* Helpful references for this extension: /* Helpful references for this extension:
* zend_parse_parameters and friends - * zend_parse_parameters and friends -
* https://git.php.net/?p=php-src.git;a=blob;f=docs/parameter-parsing-api.md;h=c962fc6ee58cc756aaac9e65759b7d5ea5c18fc4;hb=HEAD * https://git.php.net/?p=php-src.git;a=blob;f=docs/parameter-parsing-api.md;h=c962fc6ee58cc756aaac9e65759b7d5ea5c18fc4;hb=HEAD
* https://git.php.net/?p=php-src.git;a=blob;f=docs/self-contained-extensions.md;h=47f4c636baca8ca195118e2cc234ac7fd2842c1b;hb=HEAD * https://git.php.net/?p=php-src.git;a=blob;f=docs/self-contained-extensions.md;h=47f4c636baca8ca195118e2cc234ac7fd2842c1b;hb=HEAD
* Threads: * Threads:
* http://blog.jpauli.tech/2017-01-12-threads-and-php-html/ * http://blog.jpauli.tech/2017-01-12-threads-and-php-html/
* Examples: * Examples:
* Curl extension: https://github.com/php/php-src/blob/PHP-5.6/ext/curl/interface.c * Curl extension: https://github.com/php/php-src/blob/PHP-5.6/ext/curl/interface.c
* libuv extension: https://github.com/amphp/ext-uv/blob/master/php_uv.c * libuv extension: https://github.com/amphp/ext-uv/blob/master/php_uv.c
*/ */
zval aws_php_invoke_callback(zval *callback, const char *arg_types, ...) { zval aws_php_invoke_callback(zval *callback, const char *arg_types, ...) {
char *error = NULL; char *error = NULL;
zend_fcall_info fci = {0}; zend_fcall_info fci = {0};
zend_fcall_info_cache fcc = empty_fcall_info_cache; zend_fcall_info_cache fcc = empty_fcall_info_cache;
if (zend_fcall_info_init(callback, IS_CALLABLE_CHECK_SYNTAX_ONLY, &fci, &fcc, NULL, &error) == FAILURE) { if (zend_fcall_info_init(callback, IS_CALLABLE_CHECK_SYNTAX_ONLY, &fci, &fcc, NULL, &error) == FAILURE) {
aws_php_throw_exception("Unable to initialize callback from callable via zend_fcall_info_init: %s", error); aws_php_throw_exception("Unable to initialize callback from callable via zend_fcall_info_init: %s", error);
} }
/* Allocate the stack frame of zval arguments and fill them in */ /* Allocate the stack frame of zval arguments and fill them in */
const size_t num_args = strlen(arg_types); const size_t num_args = strlen(arg_types);
zval *stack = alloca(sizeof(zval) * num_args); zval *stack = alloca(sizeof(zval) * num_args);
int arg_idx = 0; int arg_idx = 0;
va_list va; va_list va;
va_start(va, arg_types); va_start(va, arg_types);
while (arg_idx < num_args) { while (arg_idx < num_args) {
const char arg_type = arg_types[arg_idx]; const char arg_type = arg_types[arg_idx];
switch (arg_type) { switch (arg_type) {
/* zval types */ /* zval types */
case 'a': case 'a':
case 'A': case 'A':
case 'n': case 'n':
case 'o': case 'o':
case 'r': case 'r':
case 'z': { case 'z': {
zval *zval_val = va_arg(va, zval *); zval *zval_val = va_arg(va, zval *);
ZVAL_ZVAL(&stack[arg_idx], zval_val, 0, 0); ZVAL_ZVAL(&stack[arg_idx], zval_val, 0, 0);
break; break;
} }
/* buffers/strings (char *, size_t) */ /* buffers/strings (char *, size_t) */
case 'p': case 'p':
case 's': { case 's': {
const char *buf = va_arg(va, const char *); const char *buf = va_arg(va, const char *);
const size_t len = va_arg(va, size_t); const size_t len = va_arg(va, size_t);
aws_php_zval_stringl(&stack[arg_idx], buf, len); aws_php_zval_stringl(&stack[arg_idx], buf, len);
break; break;
} }
/* other primitives */ /* other primitives */
case 'b': { case 'b': {
zend_bool bool_val = va_arg(va, int); zend_bool bool_val = va_arg(va, int);
ZVAL_BOOL(&stack[arg_idx], bool_val); ZVAL_BOOL(&stack[arg_idx], bool_val);
break; break;
} }
case 'd': { case 'd': {
double double_val = va_arg(va, double); double double_val = va_arg(va, double);
ZVAL_DOUBLE(&stack[arg_idx], double_val); ZVAL_DOUBLE(&stack[arg_idx], double_val);
break; break;
} }
case 'l': { case 'l': {
zend_ulong long_val = va_arg(va, zend_ulong); zend_ulong long_val = va_arg(va, zend_ulong);
ZVAL_LONG(&stack[arg_idx], long_val); ZVAL_LONG(&stack[arg_idx], long_val);
break; break;
} }
/* strings (zend_string), not supported in PHP 5.6, therefore not supported */ /* strings (zend_string), not supported in PHP 5.6, therefore not supported */
case 'P': case 'P':
case 'S': case 'S':
/* unsupported */ /* unsupported */
case 'C': case 'C':
case 'f': case 'f':
case 'h': case 'h':
case 'H': case 'H':
case 'O': case 'O':
aws_php_throw_exception("Unsupported argument type to aws_php_invoke_callback: %c", arg_type); aws_php_throw_exception("Unsupported argument type to aws_php_invoke_callback: %c", arg_type);
break; break;
default: default:
aws_php_throw_exception("Unsupported argument type to aws_php_invoke_callback: %c", arg_type); aws_php_throw_exception("Unsupported argument type to aws_php_invoke_callback: %c", arg_type);
break; break;
} }
++arg_idx; ++arg_idx;
} }
va_end(va); va_end(va);
/* set up the stack for the call */ /* set up the stack for the call */
#if AWS_PHP_AT_LEAST_7 #if AWS_PHP_AT_LEAST_7
zend_fcall_info_argp(&fci, num_args, stack); zend_fcall_info_argp(&fci, num_args, stack);
#else #else
/* PHP5.6 may mutate the arguments due to coercion */ /* PHP5.6 may mutate the arguments due to coercion */
zval **arg_ptrs = alloca(sizeof(zval *) * num_args); zval **arg_ptrs = alloca(sizeof(zval *) * num_args);
zval ***args = alloca(sizeof(zval **) * num_args); zval ***args = alloca(sizeof(zval **) * num_args);
for (int arg_idx = 0; arg_idx < num_args; ++arg_idx) { for (int arg_idx = 0; arg_idx < num_args; ++arg_idx) {
arg_ptrs[arg_idx] = &stack[arg_idx]; arg_ptrs[arg_idx] = &stack[arg_idx];
args[arg_idx] = &arg_ptrs[arg_idx]; args[arg_idx] = &arg_ptrs[arg_idx];
} }
fci.param_count = num_args; fci.param_count = num_args;
fci.params = args; fci.params = args;
#endif #endif
zval retval; zval retval;
/* PHP5 allocates its own return value, 7+ uses an existing one we provide */ /* PHP5 allocates its own return value, 7+ uses an existing one we provide */
#if !AWS_PHP_AT_LEAST_7 #if !AWS_PHP_AT_LEAST_7
zval *retval5 = NULL; zval *retval5 = NULL;
fci.retval_ptr_ptr = &retval5; fci.retval_ptr_ptr = &retval5;
#else #else
fci.retval = &retval; fci.retval = &retval;
#endif #endif
if (zend_call_function(&fci, &fcc) == FAILURE) { if (zend_call_function(&fci, &fcc) == FAILURE) {
aws_php_throw_exception("zend_call_function failed in aws_php_invoke_callback"); aws_php_throw_exception("zend_call_function failed in aws_php_invoke_callback");
} }
#if !AWS_PHP_AT_LEAST_7 #if !AWS_PHP_AT_LEAST_7
/* initialize the local retval from the retval in retval_ptr_ptr above */ /* initialize the local retval from the retval in retval_ptr_ptr above */
if (retval5) { if (retval5) {
ZVAL_ZVAL(&retval, retval5, 1, 1); ZVAL_ZVAL(&retval, retval5, 1, 1);
} }
#endif #endif
/* Clean up arguments */ /* Clean up arguments */
#if AWS_PHP_AT_LEAST_7 #if AWS_PHP_AT_LEAST_7
zend_fcall_info_args_clear(&fci, 1); zend_fcall_info_args_clear(&fci, 1);
#endif #endif
return retval; return retval;
} }
void aws_php_zval_stringl(zval *val, const char *str, size_t len) { void aws_php_zval_stringl(zval *val, const char *str, size_t len) {
AWS_FATAL_ASSERT(val != NULL); AWS_FATAL_ASSERT(val != NULL);
#if AWS_PHP_AT_LEAST_7 #if AWS_PHP_AT_LEAST_7
ZVAL_STRINGL(val, str, len); ZVAL_STRINGL(val, str, len);
#else #else
ZVAL_STRINGL(val, str, len, 1); ZVAL_STRINGL(val, str, len, 1);
#endif #endif
} }
aws_php_thread_queue s_aws_php_main_thread_queue; aws_php_thread_queue s_aws_php_main_thread_queue;
bool aws_php_is_main_thread(void) { bool aws_php_is_main_thread(void) {
return s_aws_php_main_thread_queue.thread_id == aws_thread_current_thread_id(); return s_aws_php_main_thread_queue.thread_id == aws_thread_current_thread_id();
} }
void aws_php_thread_queue_init(aws_php_thread_queue *queue) { void aws_php_thread_queue_init(aws_php_thread_queue *queue) {
aws_mutex_init(&queue->mutex); aws_mutex_init(&queue->mutex);
memset(queue->queue, 0, sizeof(aws_php_task) * AWS_PHP_THREAD_QUEUE_MAX_DEPTH); memset(queue->queue, 0, sizeof(aws_php_task) * AWS_PHP_THREAD_QUEUE_MAX_DEPTH);
queue->write_slot = 0; queue->write_slot = 0;
queue->thread_id = aws_thread_current_thread_id(); queue->thread_id = aws_thread_current_thread_id();
} }
void aws_php_thread_queue_clean_up(aws_php_thread_queue *queue) { void aws_php_thread_queue_clean_up(aws_php_thread_queue *queue) {
assert(queue->write_slot == 0 && "aws_php_thread_queue cannot be cleaned up while queue is not empty"); assert(queue->write_slot == 0 && "aws_php_thread_queue cannot be cleaned up while queue is not empty");
aws_mutex_clean_up(&queue->mutex); aws_mutex_clean_up(&queue->mutex);
} }
void aws_php_thread_queue_push(aws_php_thread_queue *queue, aws_php_task task) { void aws_php_thread_queue_push(aws_php_thread_queue *queue, aws_php_task task) {
aws_mutex_lock(&queue->mutex); aws_mutex_lock(&queue->mutex);
assert(queue->write_slot < AWS_PHP_THREAD_QUEUE_MAX_DEPTH && "thread queue is full"); assert(queue->write_slot < AWS_PHP_THREAD_QUEUE_MAX_DEPTH && "thread queue is full");
queue->queue[queue->write_slot++] = task; queue->queue[queue->write_slot++] = task;
aws_mutex_unlock(&queue->mutex); aws_mutex_unlock(&queue->mutex);
} }
bool aws_php_thread_queue_drain(aws_php_thread_queue *queue) { bool aws_php_thread_queue_drain(aws_php_thread_queue *queue) {
assert( assert(
queue->thread_id == aws_thread_current_thread_id() && queue->thread_id == aws_thread_current_thread_id() &&
"thread queue cannot be drained from a thread other than its home"); "thread queue cannot be drained from a thread other than its home");
aws_php_task drain_queue[AWS_PHP_THREAD_QUEUE_MAX_DEPTH]; aws_php_task drain_queue[AWS_PHP_THREAD_QUEUE_MAX_DEPTH];
aws_mutex_lock(&queue->mutex); aws_mutex_lock(&queue->mutex);
/* copy any queued tasks into the drain queue, then reset the queue */ /* copy any queued tasks into the drain queue, then reset the queue */
memcpy(drain_queue, queue->queue, sizeof(aws_php_task) * AWS_PHP_THREAD_QUEUE_MAX_DEPTH); memcpy(drain_queue, queue->queue, sizeof(aws_php_task) * AWS_PHP_THREAD_QUEUE_MAX_DEPTH);
memset(queue->queue, 0, sizeof(aws_php_task) * AWS_PHP_THREAD_QUEUE_MAX_DEPTH); memset(queue->queue, 0, sizeof(aws_php_task) * AWS_PHP_THREAD_QUEUE_MAX_DEPTH);
queue->write_slot = 0; queue->write_slot = 0;
aws_mutex_unlock(&queue->mutex); aws_mutex_unlock(&queue->mutex);
bool did_work = false; bool did_work = false;
for (int idx = 0; idx < AWS_PHP_THREAD_QUEUE_MAX_DEPTH; ++idx) { for (int idx = 0; idx < AWS_PHP_THREAD_QUEUE_MAX_DEPTH; ++idx) {
aws_php_task *task = &drain_queue[idx]; aws_php_task *task = &drain_queue[idx];
if (!task->callback) { if (!task->callback) {
break; break;
} }
did_work = true; did_work = true;
task->callback(task->data); task->callback(task->data);
if (task->dtor) { if (task->dtor) {
task->dtor(task->data); task->dtor(task->data);
} }
} }
return did_work; return did_work;
} }
/* called on main thread after delivery */ /* called on main thread after delivery */
static void s_thread_queue_complete_promise(void *data) { static void s_thread_queue_complete_promise(void *data) {
struct aws_promise *promise = data; struct aws_promise *promise = data;
aws_promise_complete(promise, NULL, NULL); aws_promise_complete(promise, NULL, NULL);
} }
/* called from worker thread to wait for the main thread to execute any queued work in PHP */ /* called from worker thread to wait for the main thread to execute any queued work in PHP */
void aws_php_thread_queue_yield(aws_php_thread_queue *queue) { void aws_php_thread_queue_yield(aws_php_thread_queue *queue) {
/* If on the main thread, then just drain the queue */ /* If on the main thread, then just drain the queue */
if (aws_php_is_main_thread()) { if (aws_php_is_main_thread()) {
aws_php_thread_queue_drain(queue); aws_php_thread_queue_drain(queue);
} else { } else {
/* push a task onto the end of the queue, we will return once this task completes our promise */ /* push a task onto the end of the queue, we will return once this task completes our promise */
struct aws_promise *queue_drained = aws_promise_new(aws_crt_default_allocator()); struct aws_promise *queue_drained = aws_promise_new(aws_crt_default_allocator());
aws_php_task queue_drained_task = { aws_php_task queue_drained_task = {
.callback = s_thread_queue_complete_promise, .callback = s_thread_queue_complete_promise,
.data = queue_drained, .data = queue_drained,
}; };
aws_php_thread_queue_push(queue, queue_drained_task); aws_php_thread_queue_push(queue, queue_drained_task);
aws_promise_wait(queue_drained); aws_promise_wait(queue_drained);
aws_promise_release(queue_drained); aws_promise_release(queue_drained);
} }
} }
/* called from PHP thread to wait on async queued jobs, one of which should complete the promise */ /* called from PHP thread to wait on async queued jobs, one of which should complete the promise */
void aws_php_thread_queue_wait(aws_php_thread_queue *queue, struct aws_promise *promise) { void aws_php_thread_queue_wait(aws_php_thread_queue *queue, struct aws_promise *promise) {
while (!aws_promise_is_complete(promise)) { while (!aws_promise_is_complete(promise)) {
aws_php_thread_queue_drain(queue); aws_php_thread_queue_drain(queue);
} }
} }
ZEND_DECLARE_MODULE_GLOBALS(awscrt); ZEND_DECLARE_MODULE_GLOBALS(awscrt);
PHP_INI_BEGIN() PHP_INI_BEGIN()
STD_PHP_INI_ENTRY( STD_PHP_INI_ENTRY(
"awscrt.log_level", "awscrt.log_level",
"", "",
PHP_INI_ALL, PHP_INI_ALL,
OnUpdateLongGEZero, OnUpdateLongGEZero,
log_level, log_level,
zend_awscrt_globals, zend_awscrt_globals,
awscrt_globals) awscrt_globals)
PHP_INI_END() PHP_INI_END()
static PHP_MINIT_FUNCTION(awscrt) { static PHP_MINIT_FUNCTION(awscrt) {
REGISTER_INI_ENTRIES(); REGISTER_INI_ENTRIES();
/* prevent s2n from initializing/de-initializing OpenSSL/libcrypto */ /* prevent s2n from initializing/de-initializing OpenSSL/libcrypto */
aws_crt_crypto_share(); aws_crt_crypto_share();
aws_crt_init(); aws_crt_init();
aws_php_thread_queue_init(&s_aws_php_main_thread_queue); aws_php_thread_queue_init(&s_aws_php_main_thread_queue);
return SUCCESS; return SUCCESS;
} }
static PHP_MSHUTDOWN_FUNCTION(awscrt) { static PHP_MSHUTDOWN_FUNCTION(awscrt) {
UNREGISTER_INI_ENTRIES(); UNREGISTER_INI_ENTRIES();
aws_php_thread_queue_clean_up(&s_aws_php_main_thread_queue); aws_php_thread_queue_clean_up(&s_aws_php_main_thread_queue);
aws_crt_thread_join_all(0); aws_crt_thread_join_all(0);
aws_crt_clean_up(); aws_crt_clean_up();
return SUCCESS; return SUCCESS;
} }
static PHP_GINIT_FUNCTION(awscrt) { static PHP_GINIT_FUNCTION(awscrt) {
#if defined(COMPILE_DL_ASTKIT) && defined(ZTS) #if defined(COMPILE_DL_ASTKIT) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE(); ZEND_TSRMLS_CACHE_UPDATE();
#endif #endif
awscrt_globals->log_level = 0; awscrt_globals->log_level = 0;
} }
zend_module_entry awscrt_module_entry = { zend_module_entry awscrt_module_entry = {
STANDARD_MODULE_HEADER, STANDARD_MODULE_HEADER,
"awscrt", "awscrt",
ext_functions, /* functions */ ext_functions, /* functions */
PHP_MINIT(awscrt), PHP_MINIT(awscrt),
PHP_MSHUTDOWN(awscrt), PHP_MSHUTDOWN(awscrt),
NULL, /* RINIT */ NULL, /* RINIT */
NULL, /* RSHUTDOWN */ NULL, /* RSHUTDOWN */
NULL, /* MINFO */ NULL, /* MINFO */
NO_VERSION_YET, NO_VERSION_YET,
PHP_MODULE_GLOBALS(awscrt), PHP_MODULE_GLOBALS(awscrt),
PHP_GINIT(awscrt), PHP_GINIT(awscrt),
NULL, /* GSHUTDOWN */ NULL, /* GSHUTDOWN */
NULL, /* RPOSTSHUTDOWN */ NULL, /* RPOSTSHUTDOWN */
STANDARD_MODULE_PROPERTIES_EX, STANDARD_MODULE_PROPERTIES_EX,
}; };
#ifdef COMPILE_DL_AWSCRT #ifdef COMPILE_DL_AWSCRT
ZEND_GET_MODULE(awscrt) ZEND_GET_MODULE(awscrt)
#endif #endif
/* aws_crt_last_error() */ /* aws_crt_last_error() */
PHP_FUNCTION(aws_crt_last_error) { PHP_FUNCTION(aws_crt_last_error) {
RETURN_LONG(aws_crt_last_error()); RETURN_LONG(aws_crt_last_error());
} }
/* aws_crt_error_str(int error_code) */ /* aws_crt_error_str(int error_code) */
PHP_FUNCTION(aws_crt_error_str) { PHP_FUNCTION(aws_crt_error_str) {
zend_ulong error_code = 0; zend_ulong error_code = 0;
aws_php_parse_parameters("l", &error_code); aws_php_parse_parameters("l", &error_code);
XRETURN_STRING(aws_crt_error_str(error_code)); XRETURN_STRING(aws_crt_error_str(error_code));
} }
/* aws_crt_error_name(int error_code) */ /* aws_crt_error_name(int error_code) */
PHP_FUNCTION(aws_crt_error_name) { PHP_FUNCTION(aws_crt_error_name) {
zend_ulong error_code = 0; zend_ulong error_code = 0;
aws_php_parse_parameters("l", &error_code); aws_php_parse_parameters("l", &error_code);
XRETURN_STRING(aws_crt_error_name(error_code)); XRETURN_STRING(aws_crt_error_name(error_code));
} }
/* aws_crt_error_debug_str(int error_code) */ /* aws_crt_error_debug_str(int error_code) */
PHP_FUNCTION(aws_crt_error_debug_str) { PHP_FUNCTION(aws_crt_error_debug_str) {
zend_ulong error_code = 0; zend_ulong error_code = 0;
aws_php_parse_parameters("l", &error_code); aws_php_parse_parameters("l", &error_code);
XRETURN_STRING(aws_crt_error_debug_str(error_code)); XRETURN_STRING(aws_crt_error_debug_str(error_code));
} }

View file

@ -1,48 +1,48 @@
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
#include "php_aws_crt.h" #include "php_aws_crt.h"
PHP_FUNCTION(aws_crt_event_loop_group_options_new) { PHP_FUNCTION(aws_crt_event_loop_group_options_new) {
aws_php_parse_parameters_none(); aws_php_parse_parameters_none();
aws_crt_event_loop_group_options *options = aws_crt_event_loop_group_options_new(); aws_crt_event_loop_group_options *options = aws_crt_event_loop_group_options_new();
RETURN_LONG((zend_ulong)options); RETURN_LONG((zend_ulong)options);
} }
PHP_FUNCTION(aws_crt_event_loop_group_options_release) { PHP_FUNCTION(aws_crt_event_loop_group_options_release) {
zend_ulong php_options = 0; zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options); aws_php_parse_parameters("l", &php_options);
aws_crt_event_loop_group_options *options = (void *)php_options; aws_crt_event_loop_group_options *options = (void *)php_options;
aws_crt_event_loop_group_options_release(options); aws_crt_event_loop_group_options_release(options);
} }
PHP_FUNCTION(aws_crt_event_loop_group_options_set_max_threads) { PHP_FUNCTION(aws_crt_event_loop_group_options_set_max_threads) {
zend_ulong php_options = 0; zend_ulong php_options = 0;
zend_ulong num_threads = 0; zend_ulong num_threads = 0;
aws_php_parse_parameters("ll", &php_options, &num_threads); aws_php_parse_parameters("ll", &php_options, &num_threads);
aws_crt_event_loop_group_options *options = (void *)php_options; aws_crt_event_loop_group_options *options = (void *)php_options;
aws_crt_event_loop_group_options_set_max_threads(options, num_threads); aws_crt_event_loop_group_options_set_max_threads(options, num_threads);
} }
PHP_FUNCTION(aws_crt_event_loop_group_new) { PHP_FUNCTION(aws_crt_event_loop_group_new) {
zend_ulong php_options = 0; zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options); aws_php_parse_parameters("l", &php_options);
aws_crt_event_loop_group_options *options = (void *)php_options; aws_crt_event_loop_group_options *options = (void *)php_options;
aws_crt_event_loop_group *elg = aws_crt_event_loop_group_new(options); aws_crt_event_loop_group *elg = aws_crt_event_loop_group_new(options);
RETURN_LONG((zend_ulong)elg); RETURN_LONG((zend_ulong)elg);
} }
PHP_FUNCTION(aws_crt_event_loop_group_release) { PHP_FUNCTION(aws_crt_event_loop_group_release) {
zend_ulong php_elg = 0; zend_ulong php_elg = 0;
aws_php_parse_parameters("l", &php_elg); aws_php_parse_parameters("l", &php_elg);
aws_crt_event_loop_group *elg = (void *)php_elg; aws_crt_event_loop_group *elg = (void *)php_elg;
aws_crt_event_loop_group_release(elg); aws_crt_event_loop_group_release(elg);
} }

View file

@ -1,36 +1,36 @@
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
#include "php_aws_crt.h" #include "php_aws_crt.h"
PHP_FUNCTION(aws_crt_http_message_new_from_blob) { PHP_FUNCTION(aws_crt_http_message_new_from_blob) {
const char *blob = NULL; const char *blob = NULL;
size_t blob_len = 0; size_t blob_len = 0;
aws_php_parse_parameters("s", &blob, &blob_len); aws_php_parse_parameters("s", &blob, &blob_len);
aws_crt_http_message *message = aws_crt_http_message_new_from_blob((uint8_t *)blob, blob_len); aws_crt_http_message *message = aws_crt_http_message_new_from_blob((uint8_t *)blob, blob_len);
RETURN_LONG((zend_ulong)message); RETURN_LONG((zend_ulong)message);
} }
PHP_FUNCTION(aws_crt_http_message_to_blob) { PHP_FUNCTION(aws_crt_http_message_to_blob) {
zend_ulong php_msg = 0; zend_ulong php_msg = 0;
aws_php_parse_parameters("l", &php_msg); aws_php_parse_parameters("l", &php_msg);
aws_crt_http_message *message = (void *)php_msg; aws_crt_http_message *message = (void *)php_msg;
aws_crt_buf blob; aws_crt_buf blob;
aws_crt_http_message_to_blob(message, &blob); aws_crt_http_message_to_blob(message, &blob);
XRETURN_STRINGL((const char *)blob.blob, blob.length); XRETURN_STRINGL((const char *)blob.blob, blob.length);
} }
PHP_FUNCTION(aws_crt_http_message_release) { PHP_FUNCTION(aws_crt_http_message_release) {
zend_ulong php_msg = 0; zend_ulong php_msg = 0;
aws_php_parse_parameters("l", &php_msg); aws_php_parse_parameters("l", &php_msg);
aws_crt_http_message *message = (void *)php_msg; aws_crt_http_message *message = (void *)php_msg;
aws_crt_http_message_release(message); aws_crt_http_message_release(message);
} }

View file

@ -1,65 +1,65 @@
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
#include "php_aws_crt.h" #include "php_aws_crt.h"
PHP_FUNCTION(aws_crt_log_to_stdout) { PHP_FUNCTION(aws_crt_log_to_stdout) {
aws_php_parse_parameters_none(); aws_php_parse_parameters_none();
aws_crt_log_to_stdout(); aws_crt_log_to_stdout();
} }
PHP_FUNCTION(aws_crt_log_to_stderr) { PHP_FUNCTION(aws_crt_log_to_stderr) {
aws_php_parse_parameters_none(); aws_php_parse_parameters_none();
aws_crt_log_to_stderr(); aws_crt_log_to_stderr();
} }
PHP_FUNCTION(aws_crt_log_to_file) { PHP_FUNCTION(aws_crt_log_to_file) {
const char *filename = NULL; const char *filename = NULL;
size_t filename_len = 0; size_t filename_len = 0;
/* read the filename as a path, which guarantees no NUL bytes */ /* read the filename as a path, which guarantees no NUL bytes */
aws_php_parse_parameters("p", &filename, &filename_len); aws_php_parse_parameters("p", &filename, &filename_len);
aws_crt_log_to_file(filename); aws_crt_log_to_file(filename);
} }
static void php_crt_log(const char *message, size_t len, void *user_data) { static void php_crt_log(const char *message, size_t len, void *user_data) {
php_stream *stream = user_data; php_stream *stream = user_data;
php_stream_write(stream, message, len); php_stream_write(stream, message, len);
php_stream_flush(stream); php_stream_flush(stream);
} }
PHP_FUNCTION(aws_crt_log_to_stream) { PHP_FUNCTION(aws_crt_log_to_stream) {
zval *php_log_stream = NULL; zval *php_log_stream = NULL;
aws_php_parse_parameters("r", &php_log_stream); aws_php_parse_parameters("r", &php_log_stream);
if (php_log_stream) { if (php_log_stream) {
php_stream *stream = NULL; php_stream *stream = NULL;
Z_ADDREF(*php_log_stream); Z_ADDREF(*php_log_stream);
AWS_PHP_STREAM_FROM_ZVAL(stream, php_log_stream); AWS_PHP_STREAM_FROM_ZVAL(stream, php_log_stream);
aws_crt_log_to_callback((aws_crt_log_callback *)php_crt_log, stream); aws_crt_log_to_callback((aws_crt_log_callback *)php_crt_log, stream);
} else { } else {
aws_crt_log_to_callback(NULL, NULL); aws_crt_log_to_callback(NULL, NULL);
} }
} }
PHP_FUNCTION(aws_crt_log_set_level) { PHP_FUNCTION(aws_crt_log_set_level) {
zend_ulong log_level = 0; zend_ulong log_level = 0;
aws_php_parse_parameters("l", &log_level); aws_php_parse_parameters("l", &log_level);
aws_crt_log_set_level((aws_crt_log_level)log_level); aws_crt_log_set_level((aws_crt_log_level)log_level);
} }
PHP_FUNCTION(aws_crt_log_stop) { PHP_FUNCTION(aws_crt_log_stop) {
aws_php_parse_parameters_none(); aws_php_parse_parameters_none();
aws_crt_log_stop(); aws_crt_log_stop();
} }
PHP_FUNCTION(aws_crt_log_message) { PHP_FUNCTION(aws_crt_log_message) {
zend_ulong log_level = 0; zend_ulong log_level = 0;
const char *message = NULL; const char *message = NULL;
size_t message_len = 0; size_t message_len = 0;
aws_php_parse_parameters("ls", &log_level, &message, &message_len); aws_php_parse_parameters("ls", &log_level, &message, &message_len);
aws_crt_log_message((aws_crt_log_level)log_level, (const uint8_t *)message, message_len); aws_crt_log_message((aws_crt_log_level)log_level, (const uint8_t *)message, message_len);
} }

View file

@ -1,171 +1,171 @@
#ifndef PHP_AWS_CRT_H #ifndef PHP_AWS_CRT_H
#define PHP_AWS_CRT_H #define PHP_AWS_CRT_H
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#include "php.h" #include "php.h"
#include "Zend/zend_extensions.h" /* for ZEND_EXTENSION_API_NO */ #include "Zend/zend_extensions.h" /* for ZEND_EXTENSION_API_NO */
#include <aws/common/common.h> #include <aws/common/common.h>
#include <aws/common/mutex.h> #include <aws/common/mutex.h>
#include <aws/common/promise.h> #include <aws/common/promise.h>
#include <aws/common/thread.h> #include <aws/common/thread.h>
/* ZEND_EXTENSION_API_NO from each branch of the PHP source */ /* ZEND_EXTENSION_API_NO from each branch of the PHP source */
#define AWS_PHP_EXTENSION_API_5_5 220121212 #define AWS_PHP_EXTENSION_API_5_5 220121212
#define AWS_PHP_EXTENSION_API_5_6 220131226 #define AWS_PHP_EXTENSION_API_5_6 220131226
#define AWS_PHP_EXTENSION_API_7_0 320151012 #define AWS_PHP_EXTENSION_API_7_0 320151012
#define AWS_PHP_EXTENSION_API_7_1 320160303 #define AWS_PHP_EXTENSION_API_7_1 320160303
#define AWS_PHP_EXTENSION_API_7_2 320170718 #define AWS_PHP_EXTENSION_API_7_2 320170718
#define AWS_PHP_EXTENSION_API_7_3 320180731 #define AWS_PHP_EXTENSION_API_7_3 320180731
#define AWS_PHP_EXTENSION_API_7_4 320190902 #define AWS_PHP_EXTENSION_API_7_4 320190902
#define AWS_PHP_EXTENSION_API_8_0 420200930 #define AWS_PHP_EXTENSION_API_8_0 420200930
#if ZEND_EXTENSION_API_NO < AWS_PHP_EXTENSION_API_5_5 #if ZEND_EXTENSION_API_NO < AWS_PHP_EXTENSION_API_5_5
# error "PHP >= 5.5 is required" # error "PHP >= 5.5 is required"
#endif #endif
#define AWS_PHP_AT_LEAST_7 (ZEND_EXTENSION_API_NO >= AWS_PHP_EXTENSION_API_7_0) #define AWS_PHP_AT_LEAST_7 (ZEND_EXTENSION_API_NO >= AWS_PHP_EXTENSION_API_7_0)
#define AWS_PHP_AT_LEAST_7_2 (ZEND_EXTENSION_API_NO >= AWS_PHP_EXTENSION_API_7_2) #define AWS_PHP_AT_LEAST_7_2 (ZEND_EXTENSION_API_NO >= AWS_PHP_EXTENSION_API_7_2)
ZEND_BEGIN_MODULE_GLOBALS(awscrt) ZEND_BEGIN_MODULE_GLOBALS(awscrt)
long log_level; long log_level;
ZEND_END_MODULE_GLOBALS(awscrt) ZEND_END_MODULE_GLOBALS(awscrt)
ZEND_EXTERN_MODULE_GLOBALS(awscrt) ZEND_EXTERN_MODULE_GLOBALS(awscrt)
#define AWSCRT_GLOBAL(v) ZEND_MODULE_GLOBALS_ACCESSOR(awscrt, v) #define AWSCRT_GLOBAL(v) ZEND_MODULE_GLOBALS_ACCESSOR(awscrt, v)
#if AWS_PHP_AT_LEAST_7 #if AWS_PHP_AT_LEAST_7
/* PHP 7 takes a zval*, PHP5 takes a zval** */ /* PHP 7 takes a zval*, PHP5 takes a zval** */
# define AWS_PHP_STREAM_FROM_ZVAL(s, z) php_stream_from_zval(s, z) # define AWS_PHP_STREAM_FROM_ZVAL(s, z) php_stream_from_zval(s, z)
#define XRETURN_STRINGL RETURN_STRINGL #define XRETURN_STRINGL RETURN_STRINGL
#define XRETURN_STRING RETURN_STRING #define XRETURN_STRING RETURN_STRING
#define XRETVAL_STRINGL RETVAL_STRINGL #define XRETVAL_STRINGL RETVAL_STRINGL
#define XRETVAL_STRING RETVAL_STRING #define XRETVAL_STRING RETVAL_STRING
#else /* PHP 5.5-5.6 */ #else /* PHP 5.5-5.6 */
# define AWS_PHP_STREAM_FROM_ZVAL(s, z) php_stream_from_zval(s, &z) # define AWS_PHP_STREAM_FROM_ZVAL(s, z) php_stream_from_zval(s, &z)
#define XRETURN_STRINGL(s, l) RETURN_STRINGL(s, l, 1) #define XRETURN_STRINGL(s, l) RETURN_STRINGL(s, l, 1)
#define XRETURN_STRING(s) RETURN_STRING(s, 1) #define XRETURN_STRING(s) RETURN_STRING(s, 1)
#define XRETVAL_STRINGL(s, l) RETVAL_STRINGL(s, l, 1) #define XRETVAL_STRINGL(s, l) RETVAL_STRINGL(s, l, 1)
#define XRETVAL_STRING(s) RETVAL_STRING(s, 1) #define XRETVAL_STRING(s) RETVAL_STRING(s, 1)
#endif /* PHP 5.x */ #endif /* PHP 5.x */
#include "api.h" #include "api.h"
#include "awscrt_arginfo.h" #include "awscrt_arginfo.h"
/* Utility macros borrowed from common */ /* Utility macros borrowed from common */
#define GLUE(x, y) x y #define GLUE(x, y) x y
#define RETURN_ARG_COUNT(_1_, _2_, _3_, _4_, _5_, count, ...) count #define RETURN_ARG_COUNT(_1_, _2_, _3_, _4_, _5_, count, ...) count
#define EXPAND_ARGS(args) RETURN_ARG_COUNT args #define EXPAND_ARGS(args) RETURN_ARG_COUNT args
#define COUNT_ARGS_MAX5(...) EXPAND_ARGS((__VA_ARGS__, 5, 4, 3, 2, 1, 0)) #define COUNT_ARGS_MAX5(...) EXPAND_ARGS((__VA_ARGS__, 5, 4, 3, 2, 1, 0))
#define OVERLOAD_MACRO2(name, count) name##count #define OVERLOAD_MACRO2(name, count) name##count
#define OVERLOAD_MACRO1(name, count) OVERLOAD_MACRO2(name, count) #define OVERLOAD_MACRO1(name, count) OVERLOAD_MACRO2(name, count)
#define OVERLOAD_MACRO(name, count) OVERLOAD_MACRO1(name, count) #define OVERLOAD_MACRO(name, count) OVERLOAD_MACRO1(name, count)
#define CALL_OVERLOAD(name, ...) GLUE(OVERLOAD_MACRO(name, COUNT_ARGS_MAX5(__VA_ARGS__)), (__VA_ARGS__)) #define CALL_OVERLOAD(name, ...) GLUE(OVERLOAD_MACRO(name, COUNT_ARGS_MAX5(__VA_ARGS__)), (__VA_ARGS__))
#define VARIABLE_LENGTH_ARRAY(type, name, length) type *name = alloca(sizeof(type) * (length)) #define VARIABLE_LENGTH_ARRAY(type, name, length) type *name = alloca(sizeof(type) * (length))
/* /*
* PHP utility APIs for this extension * PHP utility APIs for this extension
*/ */
/* /*
* Exception throwing mechanism, will never return * Exception throwing mechanism, will never return
*/ */
#define aws_php_throw_exception(...) CALL_OVERLOAD(_AWS_PHP_THROW_EXCEPTION, __VA_ARGS__); #define aws_php_throw_exception(...) CALL_OVERLOAD(_AWS_PHP_THROW_EXCEPTION, __VA_ARGS__);
#define _AWS_PHP_THROW_EXCEPTION5(format, ...) zend_error_noreturn(E_ERROR, format, __VA_ARGS__) #define _AWS_PHP_THROW_EXCEPTION5(format, ...) zend_error_noreturn(E_ERROR, format, __VA_ARGS__)
#define _AWS_PHP_THROW_EXCEPTION4(format, ...) zend_error_noreturn(E_ERROR, format, __VA_ARGS__) #define _AWS_PHP_THROW_EXCEPTION4(format, ...) zend_error_noreturn(E_ERROR, format, __VA_ARGS__)
#define _AWS_PHP_THROW_EXCEPTION3(format, ...) zend_error_noreturn(E_ERROR, format, __VA_ARGS__) #define _AWS_PHP_THROW_EXCEPTION3(format, ...) zend_error_noreturn(E_ERROR, format, __VA_ARGS__)
#define _AWS_PHP_THROW_EXCEPTION2(format, ...) zend_error_noreturn(E_ERROR, format, __VA_ARGS__) #define _AWS_PHP_THROW_EXCEPTION2(format, ...) zend_error_noreturn(E_ERROR, format, __VA_ARGS__)
#define _AWS_PHP_THROW_EXCEPTION1(format) zend_error_noreturn(E_ERROR, format) #define _AWS_PHP_THROW_EXCEPTION1(format) zend_error_noreturn(E_ERROR, format)
/** /**
* throws an exception resulting from argument parsing, notes the current function name in the exception * throws an exception resulting from argument parsing, notes the current function name in the exception
*/ */
#define aws_php_argparse_fail() \ #define aws_php_argparse_fail() \
do { \ do { \
aws_php_throw_exception("Failed to parse arguments to %s", __func__); \ aws_php_throw_exception("Failed to parse arguments to %s", __func__); \
} while (0) } while (0)
/** /**
* calls zend_parse_parameters() with the arguments and throws an exception if parsing fails * calls zend_parse_parameters() with the arguments and throws an exception if parsing fails
*/ */
#define aws_php_parse_parameters(type_spec, ...) \ #define aws_php_parse_parameters(type_spec, ...) \
do { \ do { \
if (zend_parse_parameters(ZEND_NUM_ARGS(), type_spec, __VA_ARGS__) == FAILURE) { \ if (zend_parse_parameters(ZEND_NUM_ARGS(), type_spec, __VA_ARGS__) == FAILURE) { \
aws_php_argparse_fail(); \ aws_php_argparse_fail(); \
} \ } \
} while (0) } while (0)
/** /**
* calls zend_parse_parameters_none() and throws an exception if parsing fails * calls zend_parse_parameters_none() and throws an exception if parsing fails
*/ */
#define aws_php_parse_parameters_none() \ #define aws_php_parse_parameters_none() \
do { \ do { \
if (zend_parse_parameters_none() == FAILURE) { \ if (zend_parse_parameters_none() == FAILURE) { \
aws_php_argparse_fail(); \ aws_php_argparse_fail(); \
} \ } \
} while (0) } while (0)
/* PHP/Zend utility functions to work across PHP versions */ /* PHP/Zend utility functions to work across PHP versions */
zval *aws_php_zval_new(void); zval *aws_php_zval_new(void);
void aws_php_zval_dtor(void *zval_ptr); void aws_php_zval_dtor(void *zval_ptr);
bool aws_php_zval_as_bool(zval *z); bool aws_php_zval_as_bool(zval *z);
void aws_php_zval_copy(zval *dest, zval *src); void aws_php_zval_copy(zval *dest, zval *src);
/** /**
* Replacement for ZVAL_STRINGL that is PHP version agnostic * Replacement for ZVAL_STRINGL that is PHP version agnostic
*/ */
void aws_php_zval_stringl(zval *val, const char *str, size_t len); void aws_php_zval_stringl(zval *val, const char *str, size_t len);
/* Thread queue functions for managing PHP's optional threading situation */ /* Thread queue functions for managing PHP's optional threading situation */
typedef struct _aws_php_task { typedef struct _aws_php_task {
void (*callback)(void *); /* task function */ void (*callback)(void *); /* task function */
void (*dtor)(void *); /* deletes task_data, if non-null */ void (*dtor)(void *); /* deletes task_data, if non-null */
void *data; void *data;
} aws_php_task; } aws_php_task;
/* maximum number of queued callbacks to execute at once. Since this is to support single-threaded usage, /* maximum number of queued callbacks to execute at once. Since this is to support single-threaded usage,
* this can be a fairly small number, as how many callbacks could we reasonably be stacking up?! */ * this can be a fairly small number, as how many callbacks could we reasonably be stacking up?! */
#define AWS_PHP_THREAD_QUEUE_MAX_DEPTH 32 #define AWS_PHP_THREAD_QUEUE_MAX_DEPTH 32
typedef struct _aws_php_thread_queue { typedef struct _aws_php_thread_queue {
struct aws_mutex mutex; struct aws_mutex mutex;
aws_php_task queue[AWS_PHP_THREAD_QUEUE_MAX_DEPTH]; aws_php_task queue[AWS_PHP_THREAD_QUEUE_MAX_DEPTH];
size_t write_slot; size_t write_slot;
aws_thread_id_t thread_id; aws_thread_id_t thread_id;
} aws_php_thread_queue; } aws_php_thread_queue;
extern aws_php_thread_queue s_aws_php_main_thread_queue; extern aws_php_thread_queue s_aws_php_main_thread_queue;
bool aws_php_is_main_thread(void); bool aws_php_is_main_thread(void);
void aws_php_thread_queue_init(aws_php_thread_queue *queue); void aws_php_thread_queue_init(aws_php_thread_queue *queue);
void aws_php_thread_queue_clean_up(aws_php_thread_queue *queue); void aws_php_thread_queue_clean_up(aws_php_thread_queue *queue);
void aws_php_thread_queue_push(aws_php_thread_queue *queue, aws_php_task task); void aws_php_thread_queue_push(aws_php_thread_queue *queue, aws_php_task task);
bool aws_php_thread_queue_drain(aws_php_thread_queue *queue); bool aws_php_thread_queue_drain(aws_php_thread_queue *queue);
/* called from worker thread to wait for the main thread to execute any queued work in PHP */ /* called from worker thread to wait for the main thread to execute any queued work in PHP */
void aws_php_thread_queue_yield(aws_php_thread_queue *queue); void aws_php_thread_queue_yield(aws_php_thread_queue *queue);
/* called from PHP thread to wait on async queued jobs, one of which MUST complete the promise */ /* called from PHP thread to wait on async queued jobs, one of which MUST complete the promise */
void aws_php_thread_queue_wait(aws_php_thread_queue *queue, struct aws_promise *promise); void aws_php_thread_queue_wait(aws_php_thread_queue *queue, struct aws_promise *promise);
/** /**
* generic dispatch mechanism to call a callback provided as a zval with arguments * generic dispatch mechanism to call a callback provided as a zval with arguments
* that are converted to zvals based on the arg_types format string * that are converted to zvals based on the arg_types format string
* Uses the same format string as zend_parse_parameters * Uses the same format string as zend_parse_parameters
*/ */
zval aws_php_invoke_callback(zval *callback, const char *arg_types, ...); zval aws_php_invoke_callback(zval *callback, const char *arg_types, ...);
#endif /* PHP_AWS_CRT_H */ #endif /* PHP_AWS_CRT_H */

View file

@ -1,33 +1,33 @@
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
#include "php_aws_crt.h" #include "php_aws_crt.h"
zval *aws_php_zval_new(void) { zval *aws_php_zval_new(void) {
return emalloc(sizeof(zval)); return emalloc(sizeof(zval));
} }
void aws_php_zval_dtor(void *zval_ptr) { void aws_php_zval_dtor(void *zval_ptr) {
zval *z = zval_ptr; zval *z = zval_ptr;
zval_dtor(z); zval_dtor(z);
efree(z); efree(z);
} }
bool aws_php_zval_as_bool(zval *z) { bool aws_php_zval_as_bool(zval *z) {
#if AWS_PHP_AT_LEAST_7 #if AWS_PHP_AT_LEAST_7
return (Z_TYPE_P(z) == IS_TRUE); return (Z_TYPE_P(z) == IS_TRUE);
#else #else
return (Z_TYPE_P(z) == IS_BOOL && Z_LVAL_P(z) != 0); return (Z_TYPE_P(z) == IS_BOOL && Z_LVAL_P(z) != 0);
#endif #endif
} }
void aws_php_zval_copy(zval *dest, zval *src) { void aws_php_zval_copy(zval *dest, zval *src) {
#if AWS_PHP_AT_LEAST_7 #if AWS_PHP_AT_LEAST_7
ZVAL_COPY(dest, src); ZVAL_COPY(dest, src);
#else #else
ZVAL_COPY_VALUE(dest, src); ZVAL_COPY_VALUE(dest, src);
#endif #endif
} }

View file

@ -1,374 +1,374 @@
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
#include "php_aws_crt.h" #include "php_aws_crt.h"
PHP_FUNCTION(aws_crt_signing_config_aws_new) { PHP_FUNCTION(aws_crt_signing_config_aws_new) {
if (zend_parse_parameters_none() == FAILURE) { if (zend_parse_parameters_none() == FAILURE) {
RETURN_NULL(); RETURN_NULL();
} }
aws_crt_signing_config_aws *signing_config = aws_crt_signing_config_aws_new(); aws_crt_signing_config_aws *signing_config = aws_crt_signing_config_aws_new();
RETURN_LONG((zend_ulong)signing_config); RETURN_LONG((zend_ulong)signing_config);
} }
PHP_FUNCTION(aws_crt_signing_config_aws_release) { PHP_FUNCTION(aws_crt_signing_config_aws_release) {
zend_ulong php_signing_config = 0; zend_ulong php_signing_config = 0;
aws_php_parse_parameters("l", &php_signing_config); aws_php_parse_parameters("l", &php_signing_config);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config; aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_release(signing_config); aws_crt_signing_config_aws_release(signing_config);
} }
PHP_FUNCTION(aws_crt_signing_config_aws_set_algorithm) { PHP_FUNCTION(aws_crt_signing_config_aws_set_algorithm) {
zend_ulong php_signing_config = 0; zend_ulong php_signing_config = 0;
zend_ulong php_algorithm = 0; zend_ulong php_algorithm = 0;
aws_php_parse_parameters("ll", &php_signing_config, &php_algorithm); aws_php_parse_parameters("ll", &php_signing_config, &php_algorithm);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config; aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_algorithm algorithm = php_algorithm; aws_crt_signing_algorithm algorithm = php_algorithm;
aws_crt_signing_config_aws_set_algorithm(signing_config, algorithm); aws_crt_signing_config_aws_set_algorithm(signing_config, algorithm);
} }
PHP_FUNCTION(aws_crt_signing_config_aws_set_signature_type) { PHP_FUNCTION(aws_crt_signing_config_aws_set_signature_type) {
zend_ulong php_signing_config = 0; zend_ulong php_signing_config = 0;
zend_ulong php_signature_type = 0; zend_ulong php_signature_type = 0;
aws_php_parse_parameters("ll", &php_signing_config, &php_signature_type); aws_php_parse_parameters("ll", &php_signing_config, &php_signature_type);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config; aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signature_type signature_type = php_signature_type; aws_crt_signature_type signature_type = php_signature_type;
aws_crt_signing_config_aws_set_signature_type(signing_config, signature_type); aws_crt_signing_config_aws_set_signature_type(signing_config, signature_type);
} }
PHP_FUNCTION(aws_crt_signing_config_aws_set_credentials_provider) { PHP_FUNCTION(aws_crt_signing_config_aws_set_credentials_provider) {
zend_ulong php_signing_config = 0; zend_ulong php_signing_config = 0;
zend_ulong php_credentials_provider = 0; zend_ulong php_credentials_provider = 0;
aws_php_parse_parameters("ll", &php_signing_config, &php_credentials_provider); aws_php_parse_parameters("ll", &php_signing_config, &php_credentials_provider);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config; aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_credentials_provider *credentials_provider = (void *)php_credentials_provider; aws_crt_credentials_provider *credentials_provider = (void *)php_credentials_provider;
aws_crt_signing_config_aws_set_credentials_provider(signing_config, credentials_provider); aws_crt_signing_config_aws_set_credentials_provider(signing_config, credentials_provider);
} }
PHP_FUNCTION(aws_crt_signing_config_aws_set_region) { PHP_FUNCTION(aws_crt_signing_config_aws_set_region) {
zend_ulong php_signing_config = 0; zend_ulong php_signing_config = 0;
const char *region = NULL; const char *region = NULL;
size_t region_len = 0; size_t region_len = 0;
aws_php_parse_parameters("ls", &php_signing_config, &region, &region_len); aws_php_parse_parameters("ls", &php_signing_config, &region, &region_len);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config; aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_region(signing_config, (uint8_t *)region, region_len); aws_crt_signing_config_aws_set_region(signing_config, (uint8_t *)region, region_len);
} }
PHP_FUNCTION(aws_crt_signing_config_aws_set_service) { PHP_FUNCTION(aws_crt_signing_config_aws_set_service) {
zend_ulong php_signing_config = 0; zend_ulong php_signing_config = 0;
const char *service = NULL; const char *service = NULL;
size_t service_len = 0; size_t service_len = 0;
aws_php_parse_parameters("ls", &php_signing_config, &service, &service_len); aws_php_parse_parameters("ls", &php_signing_config, &service, &service_len);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config; aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_service(signing_config, (uint8_t *)service, service_len); aws_crt_signing_config_aws_set_service(signing_config, (uint8_t *)service, service_len);
} }
PHP_FUNCTION(aws_crt_signing_config_aws_set_use_double_uri_encode) { PHP_FUNCTION(aws_crt_signing_config_aws_set_use_double_uri_encode) {
zend_ulong php_signing_config = 0; zend_ulong php_signing_config = 0;
zend_bool php_use_double_uri_encode = 0; zend_bool php_use_double_uri_encode = 0;
aws_php_parse_parameters("lb", &php_signing_config, &php_use_double_uri_encode); aws_php_parse_parameters("lb", &php_signing_config, &php_use_double_uri_encode);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config; aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_use_double_uri_encode(signing_config, php_use_double_uri_encode); aws_crt_signing_config_aws_set_use_double_uri_encode(signing_config, php_use_double_uri_encode);
} }
PHP_FUNCTION(aws_crt_signing_config_aws_set_should_normalize_uri_path) { PHP_FUNCTION(aws_crt_signing_config_aws_set_should_normalize_uri_path) {
zend_ulong php_signing_config = 0; zend_ulong php_signing_config = 0;
zend_bool php_should_normalize_uri_path = 0; zend_bool php_should_normalize_uri_path = 0;
aws_php_parse_parameters("lb", &php_signing_config, &php_should_normalize_uri_path); aws_php_parse_parameters("lb", &php_signing_config, &php_should_normalize_uri_path);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config; aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_should_normalize_uri_path(signing_config, php_should_normalize_uri_path); aws_crt_signing_config_aws_set_should_normalize_uri_path(signing_config, php_should_normalize_uri_path);
} }
PHP_FUNCTION(aws_crt_signing_config_aws_set_omit_session_token) { PHP_FUNCTION(aws_crt_signing_config_aws_set_omit_session_token) {
zend_ulong php_signing_config = 0; zend_ulong php_signing_config = 0;
zend_bool php_omit_session_token = 0; zend_bool php_omit_session_token = 0;
aws_php_parse_parameters("lb", &php_signing_config, &php_omit_session_token); aws_php_parse_parameters("lb", &php_signing_config, &php_omit_session_token);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config; aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_omit_session_token(signing_config, php_omit_session_token); aws_crt_signing_config_aws_set_omit_session_token(signing_config, php_omit_session_token);
} }
PHP_FUNCTION(aws_crt_signing_config_aws_set_signed_body_value) { PHP_FUNCTION(aws_crt_signing_config_aws_set_signed_body_value) {
zend_ulong php_signing_config = 0; zend_ulong php_signing_config = 0;
const char *signed_body_value = NULL; const char *signed_body_value = NULL;
size_t signed_body_value_len = 0; size_t signed_body_value_len = 0;
aws_php_parse_parameters("ls", &php_signing_config, &signed_body_value, &signed_body_value_len); aws_php_parse_parameters("ls", &php_signing_config, &signed_body_value, &signed_body_value_len);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config; aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_signed_body_value( aws_crt_signing_config_aws_set_signed_body_value(
signing_config, (uint8_t *)signed_body_value, signed_body_value_len); signing_config, (uint8_t *)signed_body_value, signed_body_value_len);
} }
PHP_FUNCTION(aws_crt_signing_config_aws_set_signed_body_header_type) { PHP_FUNCTION(aws_crt_signing_config_aws_set_signed_body_header_type) {
zend_ulong php_signing_config = 0; zend_ulong php_signing_config = 0;
zend_ulong php_signed_body_header_type = 0; zend_ulong php_signed_body_header_type = 0;
aws_php_parse_parameters("ll", &php_signing_config, &php_signed_body_header_type); aws_php_parse_parameters("ll", &php_signing_config, &php_signed_body_header_type);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config; aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signed_body_header_type signed_body_header_type = php_signed_body_header_type; aws_crt_signed_body_header_type signed_body_header_type = php_signed_body_header_type;
aws_crt_signing_config_aws_set_signed_body_header_type(signing_config, signed_body_header_type); aws_crt_signing_config_aws_set_signed_body_header_type(signing_config, signed_body_header_type);
} }
PHP_FUNCTION(aws_crt_signing_config_aws_set_expiration_in_seconds) { PHP_FUNCTION(aws_crt_signing_config_aws_set_expiration_in_seconds) {
zend_ulong php_signing_config = 0; zend_ulong php_signing_config = 0;
zend_ulong php_expiration_in_seconds = 0; zend_ulong php_expiration_in_seconds = 0;
aws_php_parse_parameters("ll", &php_signing_config, &php_expiration_in_seconds); aws_php_parse_parameters("ll", &php_signing_config, &php_expiration_in_seconds);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config; aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_expiration_in_seconds(signing_config, php_expiration_in_seconds); aws_crt_signing_config_aws_set_expiration_in_seconds(signing_config, php_expiration_in_seconds);
} }
PHP_FUNCTION(aws_crt_signing_config_aws_set_date) { PHP_FUNCTION(aws_crt_signing_config_aws_set_date) {
zend_ulong php_signing_config = 0; zend_ulong php_signing_config = 0;
zend_ulong php_timestamp = 0; zend_ulong php_timestamp = 0;
aws_php_parse_parameters("ll", &php_signing_config, &php_timestamp); aws_php_parse_parameters("ll", &php_signing_config, &php_timestamp);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config; aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_date(signing_config, php_timestamp); aws_crt_signing_config_aws_set_date(signing_config, php_timestamp);
} }
typedef struct _should_sign_header_data { typedef struct _should_sign_header_data {
zval *should_sign_header; zval *should_sign_header;
zval *header_name; zval *header_name;
bool result; bool result;
} should_sign_header_data; } should_sign_header_data;
static void should_sign_header_task(void *data) { static void should_sign_header_task(void *data) {
should_sign_header_data *task = data; should_sign_header_data *task = data;
zval result = aws_php_invoke_callback(task->should_sign_header, "z", task->header_name); zval result = aws_php_invoke_callback(task->should_sign_header, "z", task->header_name);
task->result = aws_php_zval_as_bool(&result); task->result = aws_php_zval_as_bool(&result);
zval_dtor(&result); zval_dtor(&result);
} }
static bool aws_php_should_sign_header(const char *header_name, size_t header_length, void *user_data) { static bool aws_php_should_sign_header(const char *header_name, size_t header_length, void *user_data) {
zval php_header_name; zval php_header_name;
aws_php_zval_stringl(&php_header_name, header_name, header_length); aws_php_zval_stringl(&php_header_name, header_name, header_length);
should_sign_header_data task_data = { should_sign_header_data task_data = {
.should_sign_header = user_data, .should_sign_header = user_data,
.header_name = &php_header_name, .header_name = &php_header_name,
.result = false, .result = false,
}; };
aws_php_task task = { aws_php_task task = {
.callback = should_sign_header_task, .callback = should_sign_header_task,
.data = &task_data, .data = &task_data,
}; };
aws_php_thread_queue_push(&s_aws_php_main_thread_queue, task); aws_php_thread_queue_push(&s_aws_php_main_thread_queue, task);
aws_php_thread_queue_yield(&s_aws_php_main_thread_queue); aws_php_thread_queue_yield(&s_aws_php_main_thread_queue);
zval_dtor(&php_header_name); zval_dtor(&php_header_name);
return task_data.result; return task_data.result;
} }
PHP_FUNCTION(aws_crt_signing_config_aws_set_should_sign_header_fn) { PHP_FUNCTION(aws_crt_signing_config_aws_set_should_sign_header_fn) {
zend_ulong php_signing_config = 0; zend_ulong php_signing_config = 0;
zval *php_should_sign_header = NULL; zval *php_should_sign_header = NULL;
aws_php_parse_parameters("lz", &php_signing_config, &php_should_sign_header); aws_php_parse_parameters("lz", &php_signing_config, &php_should_sign_header);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config; aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
/* copy/retain PHP callback, add as user data for signing_config resource */ /* copy/retain PHP callback, add as user data for signing_config resource */
zval *should_sign_header = aws_php_zval_new(); zval *should_sign_header = aws_php_zval_new();
aws_php_zval_copy(should_sign_header, php_should_sign_header); aws_php_zval_copy(should_sign_header, php_should_sign_header);
aws_crt_resource_set_user_data(signing_config, should_sign_header, aws_php_zval_dtor); aws_crt_resource_set_user_data(signing_config, should_sign_header, aws_php_zval_dtor);
aws_crt_signing_config_aws_set_should_sign_header_fn( aws_crt_signing_config_aws_set_should_sign_header_fn(
signing_config, aws_php_should_sign_header, should_sign_header); signing_config, aws_php_should_sign_header, should_sign_header);
} }
PHP_FUNCTION(aws_crt_signable_new_from_http_request) { PHP_FUNCTION(aws_crt_signable_new_from_http_request) {
zend_ulong php_http_message = 0; zend_ulong php_http_message = 0;
aws_php_parse_parameters("l", &php_http_message); aws_php_parse_parameters("l", &php_http_message);
const aws_crt_http_message *http_message = (void *)php_http_message; const aws_crt_http_message *http_message = (void *)php_http_message;
aws_crt_signable *signable = aws_crt_signable_new_from_http_request(http_message); aws_crt_signable *signable = aws_crt_signable_new_from_http_request(http_message);
RETURN_LONG((zend_ulong)signable); RETURN_LONG((zend_ulong)signable);
} }
PHP_FUNCTION(aws_crt_signable_new_from_chunk) { PHP_FUNCTION(aws_crt_signable_new_from_chunk) {
zend_ulong php_input_stream = 0; zend_ulong php_input_stream = 0;
const char *previous_signature = NULL; const char *previous_signature = NULL;
size_t previous_signature_len = 0; size_t previous_signature_len = 0;
aws_php_parse_parameters("ls", &php_input_stream, &previous_signature, &previous_signature_len); aws_php_parse_parameters("ls", &php_input_stream, &previous_signature, &previous_signature_len);
aws_crt_input_stream *input_stream = (void *)php_input_stream; aws_crt_input_stream *input_stream = (void *)php_input_stream;
aws_crt_signable *signable = aws_crt_signable *signable =
aws_crt_signable_new_from_chunk(input_stream, (uint8_t *)previous_signature, previous_signature_len); aws_crt_signable_new_from_chunk(input_stream, (uint8_t *)previous_signature, previous_signature_len);
RETURN_LONG((zend_ulong)signable); RETURN_LONG((zend_ulong)signable);
} }
PHP_FUNCTION(aws_crt_signable_new_from_canonical_request) { PHP_FUNCTION(aws_crt_signable_new_from_canonical_request) {
const char *canonical_request = NULL; const char *canonical_request = NULL;
size_t canonical_request_len = 0; size_t canonical_request_len = 0;
aws_crt_signable *signable = aws_crt_signable *signable =
aws_crt_signable_new_from_canonical_request((uint8_t *)canonical_request, canonical_request_len); aws_crt_signable_new_from_canonical_request((uint8_t *)canonical_request, canonical_request_len);
RETURN_LONG((zend_ulong)signable); RETURN_LONG((zend_ulong)signable);
} }
PHP_FUNCTION(aws_crt_signable_release) { PHP_FUNCTION(aws_crt_signable_release) {
zend_ulong php_signable = 0; zend_ulong php_signable = 0;
aws_php_parse_parameters("l", &php_signable); aws_php_parse_parameters("l", &php_signable);
aws_crt_signable *signable = (void *)php_signable; aws_crt_signable *signable = (void *)php_signable;
aws_crt_signable_release(signable); aws_crt_signable_release(signable);
} }
PHP_FUNCTION(aws_crt_signing_result_release) { PHP_FUNCTION(aws_crt_signing_result_release) {
zend_ulong php_signing_result = 0; zend_ulong php_signing_result = 0;
aws_php_parse_parameters("l", &php_signing_result); aws_php_parse_parameters("l", &php_signing_result);
aws_crt_signing_result *result = (void *)php_signing_result; aws_crt_signing_result *result = (void *)php_signing_result;
aws_crt_signing_result_release(result); aws_crt_signing_result_release(result);
} }
PHP_FUNCTION(aws_crt_signing_result_apply_to_http_request) { PHP_FUNCTION(aws_crt_signing_result_apply_to_http_request) {
zend_ulong php_signing_result = 0; zend_ulong php_signing_result = 0;
zend_ulong php_http_request = 0; zend_ulong php_http_request = 0;
aws_php_parse_parameters("ll", &php_signing_result, &php_http_request); aws_php_parse_parameters("ll", &php_signing_result, &php_http_request);
aws_crt_signing_result *result = (void *)php_signing_result; aws_crt_signing_result *result = (void *)php_signing_result;
aws_crt_http_message *request = (void *)php_http_request; aws_crt_http_message *request = (void *)php_http_request;
if (aws_crt_signing_result_apply_to_http_request(result, request)) { if (aws_crt_signing_result_apply_to_http_request(result, request)) {
aws_php_throw_exception( aws_php_throw_exception(
"Failed to apply signing result to HTTP request: %s", aws_crt_error_name(aws_crt_last_error())); "Failed to apply signing result to HTTP request: %s", aws_crt_error_name(aws_crt_last_error()));
} }
} }
typedef struct _signing_state { typedef struct _signing_state {
struct aws_promise *promise; struct aws_promise *promise;
zval *on_complete; zval *on_complete;
aws_crt_signing_result *signing_result; aws_crt_signing_result *signing_result;
int error_code; int error_code;
} signing_state; } signing_state;
/* called on main thread to deliver result to php */ /* called on main thread to deliver result to php */
static void s_sign_aws_complete(void *data) { static void s_sign_aws_complete(void *data) {
signing_state *state = data; signing_state *state = data;
zval *on_complete = state->on_complete; zval *on_complete = state->on_complete;
aws_php_invoke_callback(on_complete, "ll", (zend_ulong)state->signing_result, (zend_ulong)state->error_code); aws_php_invoke_callback(on_complete, "ll", (zend_ulong)state->signing_result, (zend_ulong)state->error_code);
} }
/* called from signing process in aws_sign_request_aws */ /* called from signing process in aws_sign_request_aws */
static void s_on_sign_request_aws_complete(aws_crt_signing_result *result, int error_code, void *user_data) { static void s_on_sign_request_aws_complete(aws_crt_signing_result *result, int error_code, void *user_data) {
signing_state *state = user_data; signing_state *state = user_data;
struct aws_promise *promise = state->promise; struct aws_promise *promise = state->promise;
state->signing_result = result; state->signing_result = result;
state->error_code = error_code; state->error_code = error_code;
/* /*
* Must execute PHP callback before this function returns, or signing_result will be killed * Must execute PHP callback before this function returns, or signing_result will be killed
* so the callback is queued back to the main thread and will have run when yield returns * so the callback is queued back to the main thread and will have run when yield returns
*/ */
aws_php_task complete_callback_task = { aws_php_task complete_callback_task = {
.callback = s_sign_aws_complete, .callback = s_sign_aws_complete,
.data = state, .data = state,
}; };
aws_php_thread_queue_push(&s_aws_php_main_thread_queue, complete_callback_task); aws_php_thread_queue_push(&s_aws_php_main_thread_queue, complete_callback_task);
aws_php_thread_queue_yield(&s_aws_php_main_thread_queue); aws_php_thread_queue_yield(&s_aws_php_main_thread_queue);
if (error_code) { if (error_code) {
aws_promise_fail(promise, error_code); aws_promise_fail(promise, error_code);
} else { } else {
aws_promise_complete(promise, result, NULL); aws_promise_complete(promise, result, NULL);
} }
} }
PHP_FUNCTION(aws_crt_sign_request_aws) { PHP_FUNCTION(aws_crt_sign_request_aws) {
zend_ulong php_signable = 0; zend_ulong php_signable = 0;
zend_ulong php_signing_config = 0; zend_ulong php_signing_config = 0;
zval *php_on_complete = 0; zval *php_on_complete = 0;
zend_ulong php_user_data = 0; zend_ulong php_user_data = 0;
aws_php_parse_parameters("llzl", &php_signable, &php_signing_config, &php_on_complete, &php_user_data); aws_php_parse_parameters("llzl", &php_signable, &php_signing_config, &php_on_complete, &php_user_data);
aws_crt_signable *signable = (void *)php_signable; aws_crt_signable *signable = (void *)php_signable;
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config; aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
struct aws_promise *promise = aws_promise_new(aws_crt_default_allocator()); struct aws_promise *promise = aws_promise_new(aws_crt_default_allocator());
signing_state state = { signing_state state = {
.promise = promise, .promise = promise,
.on_complete = php_on_complete, .on_complete = php_on_complete,
}; };
int ret = aws_crt_sign_request_aws(signable, signing_config, s_on_sign_request_aws_complete, &state); int ret = aws_crt_sign_request_aws(signable, signing_config, s_on_sign_request_aws_complete, &state);
if (ret != 0) { if (ret != 0) {
int last_error = aws_crt_last_error(); int last_error = aws_crt_last_error();
aws_promise_fail(promise, last_error); aws_promise_fail(promise, last_error);
aws_php_throw_exception( aws_php_throw_exception(
"aws_crt_sign_request_aws: error starting signing process: %s", aws_crt_error_name(last_error)); "aws_crt_sign_request_aws: error starting signing process: %s", aws_crt_error_name(last_error));
} }
aws_php_thread_queue_wait(&s_aws_php_main_thread_queue, promise); aws_php_thread_queue_wait(&s_aws_php_main_thread_queue, promise);
done: done:
aws_promise_release(promise); aws_promise_release(promise);
RETURN_LONG(ret); RETURN_LONG(ret);
} }
PHP_FUNCTION(aws_crt_test_verify_sigv4a_signing) { PHP_FUNCTION(aws_crt_test_verify_sigv4a_signing) {
zend_ulong php_signable = 0; zend_ulong php_signable = 0;
zend_ulong php_signing_config = 0; zend_ulong php_signing_config = 0;
const char *expected_canonical_request = NULL; const char *expected_canonical_request = NULL;
size_t expected_canonical_request_len = 0; size_t expected_canonical_request_len = 0;
const char *signature = NULL; const char *signature = NULL;
size_t signature_len = 0; size_t signature_len = 0;
const char *ecc_key_pub_x = NULL; const char *ecc_key_pub_x = NULL;
size_t ecc_key_pub_x_len = 0; size_t ecc_key_pub_x_len = 0;
const char *ecc_key_pub_y = NULL; const char *ecc_key_pub_y = NULL;
size_t ecc_key_pub_y_len = 0; size_t ecc_key_pub_y_len = 0;
aws_php_parse_parameters( aws_php_parse_parameters(
"llssss", "llssss",
&php_signable, &php_signable,
&php_signing_config, &php_signing_config,
&expected_canonical_request, &expected_canonical_request,
&expected_canonical_request_len, &expected_canonical_request_len,
&signature, &signature,
&signature_len, &signature_len,
&ecc_key_pub_x, &ecc_key_pub_x,
&ecc_key_pub_x_len, &ecc_key_pub_x_len,
&ecc_key_pub_y, &ecc_key_pub_y,
&ecc_key_pub_y_len); &ecc_key_pub_y_len);
const aws_crt_signable *signable = (void *)php_signable; const aws_crt_signable *signable = (void *)php_signable;
const aws_crt_signing_config *signing_config = (void *)php_signing_config; const aws_crt_signing_config *signing_config = (void *)php_signing_config;
bool result = AWS_OP_SUCCESS == bool result = AWS_OP_SUCCESS ==
aws_crt_test_verify_sigv4a_signing( aws_crt_test_verify_sigv4a_signing(
signable, signing_config, expected_canonical_request, signature, ecc_key_pub_x, ecc_key_pub_y); signable, signing_config, expected_canonical_request, signature, ecc_key_pub_x, ecc_key_pub_y);
RETURN_BOOL(result); RETURN_BOOL(result);
} }

View file

@ -1,148 +1,148 @@
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
#include "php_aws_crt.h" #include "php_aws_crt.h"
/* PHP streams info: /* PHP streams info:
* https://git.php.net/?p=php-src.git;a=blob;f=docs/streams.md;h=0ec3846d68bf70067297d8a6c691d2591c49b48a;hb=HEAD * https://git.php.net/?p=php-src.git;a=blob;f=docs/streams.md;h=0ec3846d68bf70067297d8a6c691d2591c49b48a;hb=HEAD
* https://github.com/php/php-src/blob/PHP-5.6.0/main/php_streams.h * https://github.com/php/php-src/blob/PHP-5.6.0/main/php_streams.h
*/ */
PHP_FUNCTION(aws_crt_input_stream_options_new) { PHP_FUNCTION(aws_crt_input_stream_options_new) {
if (zend_parse_parameters_none() == FAILURE) { if (zend_parse_parameters_none() == FAILURE) {
aws_php_argparse_fail(); aws_php_argparse_fail();
} }
aws_crt_input_stream_options *options = aws_crt_input_stream_options_new(); aws_crt_input_stream_options *options = aws_crt_input_stream_options_new();
RETURN_LONG((zend_ulong)options); RETURN_LONG((zend_ulong)options);
} }
PHP_FUNCTION(aws_crt_input_stream_options_release) { PHP_FUNCTION(aws_crt_input_stream_options_release) {
zend_ulong php_options = 0; zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options); aws_php_parse_parameters("l", &php_options);
aws_crt_input_stream_options *options = (void *)php_options; aws_crt_input_stream_options *options = (void *)php_options;
aws_crt_input_stream_options_release(options); aws_crt_input_stream_options_release(options);
} }
PHP_FUNCTION(aws_crt_input_stream_options_set_user_data) { PHP_FUNCTION(aws_crt_input_stream_options_set_user_data) {
zend_ulong php_options = 0; zend_ulong php_options = 0;
zval *user_data = NULL; zval *user_data = NULL;
aws_php_parse_parameters("lz", &php_options, &user_data); aws_php_parse_parameters("lz", &php_options, &user_data);
aws_crt_input_stream_options *options = (void *)php_options; aws_crt_input_stream_options *options = (void *)php_options;
php_stream *stream = NULL; php_stream *stream = NULL;
AWS_PHP_STREAM_FROM_ZVAL(stream, user_data); AWS_PHP_STREAM_FROM_ZVAL(stream, user_data);
aws_crt_input_stream_options_set_user_data(options, stream); aws_crt_input_stream_options_set_user_data(options, stream);
} }
static int s_php_stream_seek(void *user_data, int64_t offset, aws_crt_input_stream_seek_basis basis) { static int s_php_stream_seek(void *user_data, int64_t offset, aws_crt_input_stream_seek_basis basis) {
php_stream *stream = user_data; php_stream *stream = user_data;
return php_stream_seek(stream, offset, basis); return php_stream_seek(stream, offset, basis);
} }
static int s_php_stream_read(void *user_data, uint8_t *dest, size_t dest_length) { static int s_php_stream_read(void *user_data, uint8_t *dest, size_t dest_length) {
php_stream *stream = user_data; php_stream *stream = user_data;
return php_stream_read(stream, (char *)dest, dest_length) != 0; return php_stream_read(stream, (char *)dest, dest_length) != 0;
} }
static int s_php_stream_get_length(void *user_data, int64_t *out_length) { static int s_php_stream_get_length(void *user_data, int64_t *out_length) {
php_stream *stream = user_data; php_stream *stream = user_data;
size_t pos = php_stream_tell(stream); size_t pos = php_stream_tell(stream);
php_stream_seek(stream, 0, SEEK_END); php_stream_seek(stream, 0, SEEK_END);
*out_length = php_stream_tell(stream); *out_length = php_stream_tell(stream);
php_stream_seek(stream, pos, SEEK_SET); php_stream_seek(stream, pos, SEEK_SET);
return 0; return 0;
} }
static int s_php_stream_get_status(void *user_data, aws_crt_input_stream_status *out_status) { static int s_php_stream_get_status(void *user_data, aws_crt_input_stream_status *out_status) {
php_stream *stream = user_data; php_stream *stream = user_data;
out_status->is_valid = stream != NULL; out_status->is_valid = stream != NULL;
/* We would like to use php_stream_eof here, but certain streams (notably php://memory) /* We would like to use php_stream_eof here, but certain streams (notably php://memory)
* are not actually capable of EOF, so we get to do it the hard way */ * are not actually capable of EOF, so we get to do it the hard way */
int64_t length = 0; int64_t length = 0;
int64_t pos = 0; int64_t pos = 0;
s_php_stream_get_length(stream, &length); s_php_stream_get_length(stream, &length);
pos = php_stream_tell(stream); pos = php_stream_tell(stream);
out_status->is_end_of_stream = pos == length; out_status->is_end_of_stream = pos == length;
return 0; return 0;
} }
static void s_php_stream_destroy(void *user_data) { static void s_php_stream_destroy(void *user_data) {
(void)user_data; (void)user_data;
/* no op, stream will be freed by PHP refcount dropping from InputStream::stream */ /* no op, stream will be freed by PHP refcount dropping from InputStream::stream */
} }
PHP_FUNCTION(aws_crt_input_stream_new) { PHP_FUNCTION(aws_crt_input_stream_new) {
zend_ulong php_options = 0; zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options); aws_php_parse_parameters("l", &php_options);
aws_crt_input_stream_options *options = (void *)php_options; aws_crt_input_stream_options *options = (void *)php_options;
aws_crt_input_stream_options_set_seek(options, s_php_stream_seek); aws_crt_input_stream_options_set_seek(options, s_php_stream_seek);
aws_crt_input_stream_options_set_read(options, s_php_stream_read); aws_crt_input_stream_options_set_read(options, s_php_stream_read);
aws_crt_input_stream_options_set_get_status(options, s_php_stream_get_status); aws_crt_input_stream_options_set_get_status(options, s_php_stream_get_status);
aws_crt_input_stream_options_set_get_length(options, s_php_stream_get_length); aws_crt_input_stream_options_set_get_length(options, s_php_stream_get_length);
aws_crt_input_stream_options_set_destroy(options, s_php_stream_destroy); aws_crt_input_stream_options_set_destroy(options, s_php_stream_destroy);
aws_crt_input_stream *stream = aws_crt_input_stream_new(options); aws_crt_input_stream *stream = aws_crt_input_stream_new(options);
RETURN_LONG((zend_ulong)stream); RETURN_LONG((zend_ulong)stream);
} }
PHP_FUNCTION(aws_crt_input_stream_release) { PHP_FUNCTION(aws_crt_input_stream_release) {
zend_ulong php_stream = 0; zend_ulong php_stream = 0;
aws_php_parse_parameters("l", &php_stream); aws_php_parse_parameters("l", &php_stream);
aws_crt_input_stream *stream = (void *)php_stream; aws_crt_input_stream *stream = (void *)php_stream;
aws_crt_input_stream_release(stream); aws_crt_input_stream_release(stream);
} }
PHP_FUNCTION(aws_crt_input_stream_seek) { PHP_FUNCTION(aws_crt_input_stream_seek) {
zend_ulong php_stream = 0; zend_ulong php_stream = 0;
zend_ulong offset = 0; zend_ulong offset = 0;
zend_ulong basis = 0; zend_ulong basis = 0;
aws_php_parse_parameters("lll", &php_stream, &offset, &basis); aws_php_parse_parameters("lll", &php_stream, &offset, &basis);
aws_crt_input_stream *stream = (void *)php_stream; aws_crt_input_stream *stream = (void *)php_stream;
RETURN_LONG(aws_crt_input_stream_seek(stream, offset, basis)); RETURN_LONG(aws_crt_input_stream_seek(stream, offset, basis));
} }
PHP_FUNCTION(aws_crt_input_stream_read) { PHP_FUNCTION(aws_crt_input_stream_read) {
zend_ulong php_stream = 0; zend_ulong php_stream = 0;
zend_ulong length = 0; zend_ulong length = 0;
aws_php_parse_parameters("ll", &php_stream, &length); aws_php_parse_parameters("ll", &php_stream, &length);
aws_crt_input_stream *stream = (void *)php_stream; aws_crt_input_stream *stream = (void *)php_stream;
uint8_t *buf = emalloc(length); uint8_t *buf = emalloc(length);
int ret = aws_crt_input_stream_read(stream, buf, length); int ret = aws_crt_input_stream_read(stream, buf, length);
XRETVAL_STRINGL((const char *)buf, length); XRETVAL_STRINGL((const char *)buf, length);
efree(buf); efree(buf);
} }
PHP_FUNCTION(aws_crt_input_stream_eof) { PHP_FUNCTION(aws_crt_input_stream_eof) {
zend_ulong php_stream = 0; zend_ulong php_stream = 0;
aws_php_parse_parameters("l", &php_stream); aws_php_parse_parameters("l", &php_stream);
aws_crt_input_stream *stream = (void *)php_stream; aws_crt_input_stream *stream = (void *)php_stream;
aws_crt_input_stream_status status = {0}; aws_crt_input_stream_status status = {0};
aws_crt_input_stream_get_status(stream, &status); aws_crt_input_stream_get_status(stream, &status);
RETURN_BOOL(status.is_end_of_stream); RETURN_BOOL(status.is_end_of_stream);
} }
PHP_FUNCTION(aws_crt_input_stream_get_length) { PHP_FUNCTION(aws_crt_input_stream_get_length) {
zend_ulong php_stream = 0; zend_ulong php_stream = 0;
aws_php_parse_parameters("l", &php_stream); aws_php_parse_parameters("l", &php_stream);
aws_crt_input_stream *stream = (void *)php_stream; aws_crt_input_stream *stream = (void *)php_stream;
int64_t length = 0; int64_t length = 0;
aws_crt_input_stream_get_length(stream, &length); aws_crt_input_stream_get_length(stream, &length);
RETURN_LONG(length); RETURN_LONG(length);
} }

View file

@ -1,24 +1,24 @@
#!/bin/bash #!/bin/bash
if [[ -z $CLANG_FORMAT ]] ; then if [[ -z $CLANG_FORMAT ]] ; then
CLANG_FORMAT=clang-format CLANG_FORMAT=clang-format
fi fi
if NOT type $CLANG_FORMAT 2> /dev/null ; then if NOT type $CLANG_FORMAT 2> /dev/null ; then
echo "No appropriate clang-format found." echo "No appropriate clang-format found."
exit 1 exit 1
fi fi
FAIL=0 FAIL=0
SOURCE_FILES=`find src ext -type f \( -name '*.c' \)` SOURCE_FILES=`find src ext -type f \( -name '*.c' \)`
for i in $SOURCE_FILES for i in $SOURCE_FILES
do do
$CLANG_FORMAT -output-replacements-xml $i | grep -c "<replacement " > /dev/null $CLANG_FORMAT -output-replacements-xml $i | grep -c "<replacement " > /dev/null
if [ $? -ne 1 ] if [ $? -ne 1 ]
then then
echo "$i failed clang-format check." echo "$i failed clang-format check."
FAIL=1 FAIL=1
fi fi
done done
exit $FAIL exit $FAIL

View file

@ -1,24 +1,24 @@
<?php <?php
$source = "php://stdin"; $source = "php://stdin";
if (isset($argv[1])) { if (isset($argv[1])) {
$source = $argv[1]; $source = $argv[1];
} }
$input_lines = file($source); $input_lines = file($source);
foreach ($input_lines as $line) { foreach ($input_lines as $line) {
// Strip AWS_EXTERN_C_BEGIN/END // Strip AWS_EXTERN_C_BEGIN/END
if (preg_match('/AWS_EXTERN_C/', $line)) { if (preg_match('/AWS_EXTERN_C/', $line)) {
continue; continue;
} }
// Strip macros/includes // Strip macros/includes
if (preg_match('/^#/', $line)) { if (preg_match('/^#/', $line)) {
continue; continue;
} }
// Strip visibility attributes // Strip visibility attributes
$line = str_replace('AWS_CRT_API ', '', $line); $line = str_replace('AWS_CRT_API ', '', $line);
echo($line); echo($line);
} }

File diff suppressed because it is too large Load diff

View file

@ -1,19 +1,19 @@
</contents> </contents>
<dependencies> <dependencies>
<required> <required>
<php> <php>
<min>7.4.0</min> <min>7.4.0</min>
</php> </php>
<pearinstaller> <pearinstaller>
<min>1.10.0</min> <min>1.10.0</min>
</pearinstaller> </pearinstaller>
</required> </required>
</dependencies> </dependencies>
<providesextension>awscrt</providesextension> <providesextension>awscrt</providesextension>
<extsrcrelease/> <extsrcrelease/>
<changelog> <changelog>
<release> <release>
</release> </release>
</changelog> </changelog>
</package> </package>

View file

@ -1,24 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.8.1" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <package packagerversion="1.8.1" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
<name>awscrt</name> <name>awscrt</name>
<channel>pecl.php.net</channel> <channel>pecl.php.net</channel>
<summary>AWS Common Runtime PHP bindings</summary> <summary>AWS Common Runtime PHP bindings</summary>
<description>AWS Common Runtime provides a set of low level tools as network protocols and authentication used by the AWSSDK for PHP to provide high level API to access AWS services.</description> <description>AWS Common Runtime provides a set of low level tools as network protocols and authentication used by the AWSSDK for PHP to provide high level API to access AWS services.</description>
<lead> <lead>
<name>{{{NAME}}}</name> <name>{{{NAME}}}</name>
<user>{{{USER}}}</user> <user>{{{USER}}}</user>
<email>{{{EMAIL}}}</email> <email>{{{EMAIL}}}</email>
<active>yes</active> <active>yes</active>
</lead> </lead>
<date>{{{TODAY}}}</date> <date>{{{TODAY}}}</date>
<version> <version>
<release>{{{VERSION}}}</release> <release>{{{VERSION}}}</release>
<api>1.0.0</api> <api>1.0.0</api>
</version> </version>
<stability> <stability>
<release>devel</release> <release>devel</release>
<api>stable</api> <api>stable</api>
</stability> </stability>
<license uri="https://www.apache.org/licenses/LICENSE-2.0">Apache License Version 2.0</license> <license uri="https://www.apache.org/licenses/LICENSE-2.0">Apache License Version 2.0</license>
<notes>{{{NOTES}}}</notes> <notes>{{{NOTES}}}</notes>
<contents> <contents>

View file

@ -1,2 +1,2 @@
extension=php_awscrt.dll extension=php_awscrt.dll
extension=php_openssl.dll extension=php_openssl.dll

View file

@ -1 +1 @@
extension=modules/awscrt.so extension=modules/awscrt.so

View file

@ -1,144 +1,144 @@
#!/bin/zsh #!/bin/zsh
zparseopts -A opts -name: -user: -email: -version: -notes: zparseopts -A opts -name: -user: -email: -version: -notes:
if [[ $# -lt 10 ]] if [[ $# -lt 10 ]]
then then
echo "Usage ${0} --name NAME, --user USER --email EMAIL --version VERSION --notes NOTES" echo "Usage ${0} --name NAME, --user USER --email EMAIL --version VERSION --notes NOTES"
exit 1 exit 1
fi fi
NAME="${opts[--name]}" NAME="${opts[--name]}"
USER="${opts[--user]}" USER="${opts[--user]}"
EMAIL="${opts[--email]}" EMAIL="${opts[--email]}"
VERSION="${opts[--version]}" VERSION="${opts[--version]}"
NOTES="${opts[--notes]}" NOTES="${opts[--notes]}"
TODAY=$(date -u +%Y-%m-%d) TODAY=$(date -u +%Y-%m-%d)
cat package.xml-template_pre \ cat package.xml-template_pre \
| sed "s/{{{NAME}}}/$NAME/g" \ | sed "s/{{{NAME}}}/$NAME/g" \
| sed "s/{{{USER}}}/$USER/g" \ | sed "s/{{{USER}}}/$USER/g" \
| sed "s/{{{EMAIL}}}/$EMAIL/g" \ | sed "s/{{{EMAIL}}}/$EMAIL/g" \
| sed "s/{{{TODAY}}}/$TODAY/g" \ | sed "s/{{{TODAY}}}/$TODAY/g" \
| sed "s/{{{VERSION}}}/$VERSION/g" \ | sed "s/{{{VERSION}}}/$VERSION/g" \
| sed "s/{{{NOTES}}}/$NOTES/g" | sed "s/{{{NOTES}}}/$NOTES/g"
source_ext='(c|cc|h|cpp|hpp|m4|w32|ini|frag|cmake|inl|in|py|gnu|yaml|def|pl|S|s|errordata|go|lds|num|asm|mod|peg|mk|rs|toml|sh)' source_ext='(c|cc|h|cpp|hpp|m4|w32|ini|frag|cmake|inl|in|py|gnu|yaml|def|pl|S|s|errordata|go|lds|num|asm|mod|peg|mk|rs|toml|sh)'
doc_ext='(md|json|html|dot|graphml|png|gn|sha1|css|rst|)' doc_ext='(md|json|html|dot|graphml|png|gn|sha1|css|rst|)'
special_docs='(LICENSE*|NOTICE|changelog.txt|CHANGELOG|THIRD-PARTY|README*|readme|METADATA|CONTRIBUTORS|UPDATING|doc.config)' special_docs='(LICENSE*|NOTICE|changelog.txt|CHANGELOG|THIRD-PARTY|README*|readme|METADATA|CONTRIBUTORS|UPDATING|doc.config)'
special_tests='(ci-test.sh|format-check.sh|run_tests*|sanitizer-blacklist.txt|run-clang-tidy.sh|benchmark-build-run.sh|break-tests.sh|generate-coverage.sh|test.xml)' special_tests='(ci-test.sh|format-check.sh|run_tests*|sanitizer-blacklist.txt|run-clang-tidy.sh|benchmark-build-run.sh|break-tests.sh|generate-coverage.sh|test.xml)'
special_src='(gen_api.php|gen_stub.php|CMakeLists.txt|post.sh|postun.sh|Makefile*|build-buildspec.sh|build-deps.sh|objects.txt|go.*|BUILD*|DEPS|install_and_run.sh|codemod.sh|requirements.txt)' special_src='(gen_api.php|gen_stub.php|CMakeLists.txt|post.sh|postun.sh|Makefile*|build-buildspec.sh|build-deps.sh|objects.txt|go.*|BUILD*|DEPS|install_and_run.sh|codemod.sh|requirements.txt)'
skip_files='(package.xml*|prepare_release.sh|codereview.settings|*.o|*.a|*.obj|*.lib|break-tests-android.sh|whitespace.txt|prepare_package_xml.sh|crypto_test_data.cc|*.pdf|*.svg|*.docx|cbmc-proof.txt|codecov*|litani*|*.toml)' skip_files='(package.xml*|prepare_release.sh|codereview.settings|*.o|*.a|*.obj|*.lib|break-tests-android.sh|whitespace.txt|prepare_package_xml.sh|crypto_test_data.cc|*.pdf|*.svg|*.docx|cbmc-proof.txt|codecov*|litani*|*.toml)'
special_scripts='(awscrt.stub.php)' special_scripts='(awscrt.stub.php)'
skip_directories='(tests|test|AWSCRTAndroidTestRunner|docker-images|codebuild|fuzz|verfication|third_party|docs|generated-src|aws-lc|aws-crt-sys)' skip_directories='(tests|test|AWSCRTAndroidTestRunner|docker-images|codebuild|fuzz|verfication|third_party|docs|generated-src|aws-lc|aws-crt-sys)'
process_file() { process_file() {
if (( $# == 0 )) if (( $# == 0 ))
then then
echo "ERROR: filename not passed" echo "ERROR: filename not passed"
exit 1 exit 1
fi fi
if [[ $1 = $~skip_files ]] if [[ $1 = $~skip_files ]]
then then
# This file is not part of the release bundle # This file is not part of the release bundle
return 0 return 0
fi fi
echo -n '<file name="'"$1"'" role="' echo -n '<file name="'"$1"'" role="'
# Special cases # Special cases
case ${a} in case ${a} in
$~special_scripts) $~special_scripts)
echo -n 'script' echo -n 'script'
;; ;;
$~special_docs) $~special_docs)
echo -n 'doc' echo -n 'doc'
;; ;;
$~special_tests) $~special_tests)
echo -n 'test' echo -n 'test'
;; ;;
$~special_src) $~special_src)
echo -n 'src' echo -n 'src'
;; ;;
*) *)
# Extension based cases # Extension based cases
case ${a:t:e} in case ${a:t:e} in
$~source_ext) $~source_ext)
echo -n 'src' echo -n 'src'
;; ;;
$~doc_ext) $~doc_ext)
echo -n 'doc' echo -n 'doc'
;; ;;
php) php)
echo -n 'script' echo -n 'script'
;; ;;
*) *)
echo "${a:t:e} - ${a} - FAIL TO RECOGNIZE" echo "${a:t:e} - ${a} - FAIL TO RECOGNIZE"
exit 1 exit 1
esac esac
esac esac
echo '"/>' echo '"/>'
return 0 return 0
} }
process_dir() { process_dir() {
if (( $# == 0 )) if (( $# == 0 ))
then then
echo "WARNING: dirname not passed" echo "WARNING: dirname not passed"
exit 1 exit 1
fi fi
if [[ "${1}" = $~skip_directories ]] if [[ "${1}" = $~skip_directories ]]
then then
return 0 return 0
fi fi
echo '<dir name="'"$1"'">' echo '<dir name="'"$1"'">'
cd "$1" cd "$1"
for a in * for a in *
do do
if [[ -f ${a} ]] if [[ -f ${a} ]]
then process_file "${a}" then process_file "${a}"
else process_dir "${a}" else process_dir "${a}"
fi fi
done done
# Special cases for compiler features placed in tests directories in and s2n # Special cases for compiler features placed in tests directories in and s2n
if [[ "${1}" = "s2n" && -d tests ]] if [[ "${1}" = "s2n" && -d tests ]]
then then
echo '<dir name="tests">' echo '<dir name="tests">'
echo '<dir name="features">' echo '<dir name="features">'
cd tests/features cd tests/features
for a in * for a in *
do do
process_file "${a}" process_file "${a}"
done done
cd ../.. cd ../..
echo '</dir>' echo '</dir>'
echo '</dir>' echo '</dir>'
fi fi
echo '</dir>' echo '</dir>'
cd .. cd ..
return 0 return 0
} }
echo '<dir name="/">' echo '<dir name="/">'
for a in * for a in *
do do
if [[ ${a} == 'tests' ]] if [[ ${a} == 'tests' ]]
then then
echo '<dir name="tests">' echo '<dir name="tests">'
for b in tests/* for b in tests/*
do do
echo '<file name="'$( basename "${b}" )'" role="test" />' echo '<file name="'$( basename "${b}" )'" role="test" />'
done done
echo '</dir>' echo '</dir>'
continue continue
fi fi
if [[ -f ${a} ]] if [[ -f ${a} ]]
then process_file "${a}" then process_file "${a}"
else process_dir "${a}" else process_dir "${a}"
fi fi
done done
echo '</dir>' echo '</dir>'
cat package.xml-template_post cat package.xml-template_post

View file

@ -1,31 +1,31 @@
#!/bin/zsh #!/bin/zsh
zparseopts -A opts -name: -user: -email: -version: -notes: zparseopts -A opts -name: -user: -email: -version: -notes:
if [[ $# -lt 10 ]]; then if [[ $# -lt 10 ]]; then
echo "Usage ${0} --name NAME --user USER --email EMAIL --version VERSION --notes NOTES" echo "Usage ${0} --name NAME --user USER --email EMAIL --version VERSION --notes NOTES"
exit 1 exit 1
fi fi
PACKAGE='awscrt' PACKAGE='awscrt'
NAME="${opts[--name]}" NAME="${opts[--name]}"
USER="${opts[--user]}" USER="${opts[--user]}"
EMAIL="${opts[--email]}" EMAIL="${opts[--email]}"
VERSION="${opts[--version]}" VERSION="${opts[--version]}"
NOTES="${opts[--notes]}" NOTES="${opts[--notes]}"
./prepare_package_xml.sh --name "${NAME}" --user "${USER}" --email "${EMAIL}" --version "${VERSION}" --notes "${NOTES}" >package.xml ./prepare_package_xml.sh --name "${NAME}" --user "${USER}" --email "${EMAIL}" --version "${VERSION}" --notes "${NOTES}" >package.xml
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo "ERROR PROCESSING review package.xml" echo "ERROR PROCESSING review package.xml"
exit 1 exit 1
fi fi
tidy -xml -m -i package.xml tidy -xml -m -i package.xml
pear package-validate pear package-validate
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo "ERROR VALIDATING review package.xml" echo "ERROR VALIDATING review package.xml"
exit 1 exit 1
fi fi
pear package pear package
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo "ERROR PROCESSING review package.xml" echo "ERROR PROCESSING review package.xml"
exit 1 exit 1
fi fi
echo "Size of ${PACKAGE}-${VERSION}.tgz: " $(du -h "${PACKAGE}-${VERSION}.tgz") echo "Size of ${PACKAGE}-${VERSION}.tgz: " $(du -h "${PACKAGE}-${VERSION}.tgz")

View file

@ -1,18 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -ex set -ex
launcher= launcher=
if command -v catchsegv; then if command -v catchsegv; then
launcher=catchsegv launcher=catchsegv
fi fi
if [ -z $PHP_BINARY ]; then if [ -z $PHP_BINARY ]; then
PHP_BINARY=$(which php) PHP_BINARY=$(which php)
fi fi
if [ ! -d vendor ]; then if [ ! -d vendor ]; then
composer update composer update
fi fi
$launcher $PHP_BINARY -c php.ini vendor/bin/phpunit tests --debug $launcher $PHP_BINARY -c php.ini vendor/bin/phpunit tests --debug

View file

@ -1,4 +1,4 @@
@echo on @echo on
%PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug %PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug

View file

@ -1,3 +1,3 @@
api.h api.h
pkgconfig/ pkgconfig/
*.so* *.so*

View file

@ -1,69 +1,69 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT\Auth; namespace AWS\CRT\Auth;
use AWS\CRT\NativeResource as NativeResource; use AWS\CRT\NativeResource as NativeResource;
use AWS\CRT\Options as Options; use AWS\CRT\Options as Options;
/** /**
* Represents a set of AWS credentials * Represents a set of AWS credentials
* *
* @param array options: * @param array options:
* - string access_key_id - AWS Access Key Id * - string access_key_id - AWS Access Key Id
* - string secret_access_key - AWS Secret Access Key * - string secret_access_key - AWS Secret Access Key
* - string session_token - Optional STS session token * - string session_token - Optional STS session token
* - int expiration_timepoint_seconds - Optional time to expire these credentials * - int expiration_timepoint_seconds - Optional time to expire these credentials
*/ */
final class AwsCredentials extends NativeResource { final class AwsCredentials extends NativeResource {
static function defaults() { static function defaults() {
return [ return [
'access_key_id' => '', 'access_key_id' => '',
'secret_access_key' => '', 'secret_access_key' => '',
'session_token' => '', 'session_token' => '',
'expiration_timepoint_seconds' => 0, 'expiration_timepoint_seconds' => 0,
]; ];
} }
private $access_key_id; private $access_key_id;
private $secret_access_key; private $secret_access_key;
private $session_token; private $session_token;
private $expiration_timepoint_seconds = 0; private $expiration_timepoint_seconds = 0;
public function __get($name) { public function __get($name) {
return $this->$name; return $this->$name;
} }
function __construct(array $options = []) { function __construct(array $options = []) {
parent::__construct(); parent::__construct();
$options = new Options($options, self::defaults()); $options = new Options($options, self::defaults());
$this->access_key_id = $options->access_key_id->asString(); $this->access_key_id = $options->access_key_id->asString();
$this->secret_access_key = $options->secret_access_key->asString(); $this->secret_access_key = $options->secret_access_key->asString();
$this->session_token = $options->session_token ? $options->session_token->asString() : null; $this->session_token = $options->session_token ? $options->session_token->asString() : null;
$this->expiration_timepoint_seconds = $options->expiration_timepoint_seconds->asInt(); $this->expiration_timepoint_seconds = $options->expiration_timepoint_seconds->asInt();
if (strlen($this->access_key_id) == 0) { if (strlen($this->access_key_id) == 0) {
throw new \InvalidArgumentException("access_key_id must be provided"); throw new \InvalidArgumentException("access_key_id must be provided");
} }
if (strlen($this->secret_access_key) == 0) { if (strlen($this->secret_access_key) == 0) {
throw new \InvalidArgumentException("secret_access_key must be provided"); throw new \InvalidArgumentException("secret_access_key must be provided");
} }
$creds_options = self::$crt->aws_credentials_options_new(); $creds_options = self::$crt->aws_credentials_options_new();
self::$crt->aws_credentials_options_set_access_key_id($creds_options, $this->access_key_id); self::$crt->aws_credentials_options_set_access_key_id($creds_options, $this->access_key_id);
self::$crt->aws_credentials_options_set_secret_access_key($creds_options, $this->secret_access_key); self::$crt->aws_credentials_options_set_secret_access_key($creds_options, $this->secret_access_key);
self::$crt->aws_credentials_options_set_session_token($creds_options, $this->session_token); self::$crt->aws_credentials_options_set_session_token($creds_options, $this->session_token);
self::$crt->aws_credentials_options_set_expiration_timepoint_seconds($creds_options, $this->expiration_timepoint_seconds); self::$crt->aws_credentials_options_set_expiration_timepoint_seconds($creds_options, $this->expiration_timepoint_seconds);
$this->acquire(self::$crt->aws_credentials_new($creds_options)); $this->acquire(self::$crt->aws_credentials_new($creds_options));
self::$crt->aws_credentials_options_release($creds_options); self::$crt->aws_credentials_options_release($creds_options);
} }
function __destruct() { function __destruct() {
self::$crt->aws_credentials_release($this->release()); self::$crt->aws_credentials_release($this->release());
parent::__destruct(); parent::__destruct();
} }
} }

View file

@ -1,23 +1,23 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT\Auth; namespace AWS\CRT\Auth;
use AWS\CRT\NativeResource as NativeResource; use AWS\CRT\NativeResource as NativeResource;
/** /**
* Base class for credentials providers * Base class for credentials providers
*/ */
abstract class CredentialsProvider extends NativeResource { abstract class CredentialsProvider extends NativeResource {
function __construct(array $options = []) { function __construct(array $options = []) {
parent::__construct(); parent::__construct();
} }
function __destruct() { function __destruct() {
self::$crt->credentials_provider_release($this->release()); self::$crt->credentials_provider_release($this->release());
parent::__destruct(); parent::__destruct();
} }
} }

View file

@ -1,43 +1,43 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT\Auth; namespace AWS\CRT\Auth;
use AWS\CRT\IO\InputStream; use AWS\CRT\IO\InputStream;
use AWS\CRT\NativeResource as NativeResource; use AWS\CRT\NativeResource as NativeResource;
class Signable extends NativeResource { class Signable extends NativeResource {
public static function fromHttpRequest($http_message) { public static function fromHttpRequest($http_message) {
return new Signable(function() use ($http_message) { return new Signable(function() use ($http_message) {
return self::$crt->signable_new_from_http_request($http_message->native); return self::$crt->signable_new_from_http_request($http_message->native);
}); });
} }
public static function fromChunk($chunk_stream, $previous_signature="") { public static function fromChunk($chunk_stream, $previous_signature="") {
if (!($chunk_stream instanceof InputStream)) { if (!($chunk_stream instanceof InputStream)) {
$chunk_stream = new InputStream($chunk_stream); $chunk_stream = new InputStream($chunk_stream);
} }
return new Signable(function() use($chunk_stream, $previous_signature) { return new Signable(function() use($chunk_stream, $previous_signature) {
return self::$crt->signable_new_from_chunk($chunk_stream->native, $previous_signature); return self::$crt->signable_new_from_chunk($chunk_stream->native, $previous_signature);
}); });
} }
public static function fromCanonicalRequest($canonical_request) { public static function fromCanonicalRequest($canonical_request) {
return new Signable(function() use($canonical_request) { return new Signable(function() use($canonical_request) {
return self::$crt->signable_new_from_canonical_request($canonical_request); return self::$crt->signable_new_from_canonical_request($canonical_request);
}); });
} }
protected function __construct($ctor) { protected function __construct($ctor) {
parent::__construct(); parent::__construct();
$this->acquire($ctor()); $this->acquire($ctor());
} }
function __destruct() { function __destruct() {
self::$crt->signable_release($this->release()); self::$crt->signable_release($this->release());
parent::__destruct(); parent::__destruct();
} }
} }

View file

@ -1,15 +1,15 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT\Auth; namespace AWS\CRT\Auth;
class SignatureType { class SignatureType {
const HTTP_REQUEST_HEADERS = 0; const HTTP_REQUEST_HEADERS = 0;
const HTTP_REQUEST_QUERY_PARAMS = 1; const HTTP_REQUEST_QUERY_PARAMS = 1;
const HTTP_REQUEST_CHUNK = 2; const HTTP_REQUEST_CHUNK = 2;
const HTTP_REQUEST_EVENT = 3; const HTTP_REQUEST_EVENT = 3;
const CANONICAL_REQUEST_HEADERS = 4; const CANONICAL_REQUEST_HEADERS = 4;
const CANONICAL_REQUEST_QUERY_PARAMS = 5; const CANONICAL_REQUEST_QUERY_PARAMS = 5;
} }

View file

@ -1,11 +1,11 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT\Auth; namespace AWS\CRT\Auth;
class SignedBodyHeaderType { class SignedBodyHeaderType {
const NONE = 0; const NONE = 0;
const X_AMZ_CONTENT_SHA256 = 1; const X_AMZ_CONTENT_SHA256 = 1;
} }

View file

@ -1,22 +1,22 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT\Auth; namespace AWS\CRT\Auth;
use AWS\CRT\NativeResource; use AWS\CRT\NativeResource;
abstract class Signing extends NativeResource { abstract class Signing extends NativeResource {
static function signRequestAws($signable, $signing_config, $on_complete) { static function signRequestAws($signable, $signing_config, $on_complete) {
return self::$crt->sign_request_aws($signable->native, $signing_config->native, return self::$crt->sign_request_aws($signable->native, $signing_config->native,
function($result, $error_code) use ($on_complete) { function($result, $error_code) use ($on_complete) {
$signing_result = SigningResult::fromNative($result); $signing_result = SigningResult::fromNative($result);
$on_complete($signing_result, $error_code); $on_complete($signing_result, $error_code);
}, null); }, null);
} }
static function testVerifySigV4ASigning($signable, $signing_config, $expected_canonical_request, $signature, $ecc_key_pub_x, $ecc_key_pub_y) { static function testVerifySigV4ASigning($signable, $signing_config, $expected_canonical_request, $signature, $ecc_key_pub_x, $ecc_key_pub_y) {
return self::$crt->test_verify_sigv4a_signing($signable, $signing_config, $expected_canonical_request, $signature, $ecc_key_pub_x, $ecc_key_pub_y); return self::$crt->test_verify_sigv4a_signing($signable, $signing_config, $expected_canonical_request, $signature, $ecc_key_pub_x, $ecc_key_pub_y);
} }
} }

View file

@ -1,11 +1,11 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT\Auth; namespace AWS\CRT\Auth;
class SigningAlgorithm { class SigningAlgorithm {
const SIGv4 = 0; const SIGv4 = 0;
const SIGv4_ASYMMETRIC = 1; const SIGv4_ASYMMETRIC = 1;
} }

View file

@ -1,75 +1,75 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT\Auth; namespace AWS\CRT\Auth;
use AWS\CRT\NativeResource as NativeResource; use AWS\CRT\NativeResource as NativeResource;
use AWS\CRT\Options as Options; use AWS\CRT\Options as Options;
class SigningConfigAWS extends NativeResource { class SigningConfigAWS extends NativeResource {
public static function defaults() { public static function defaults() {
return [ return [
'algorithm' => SigningAlgorithm::SIGv4, 'algorithm' => SigningAlgorithm::SIGv4,
'signature_type' => SignatureType::HTTP_REQUEST_HEADERS, 'signature_type' => SignatureType::HTTP_REQUEST_HEADERS,
'credentials_provider' => null, 'credentials_provider' => null,
'region' => null, 'region' => null,
'service' => null, 'service' => null,
'use_double_uri_encode' => false, 'use_double_uri_encode' => false,
'should_normalize_uri_path' => false, 'should_normalize_uri_path' => false,
'omit_session_token' => false, 'omit_session_token' => false,
'signed_body_value' => null, 'signed_body_value' => null,
'signed_body_header_type' => SignedBodyHeaderType::NONE, 'signed_body_header_type' => SignedBodyHeaderType::NONE,
'expiration_in_seconds' => 0, 'expiration_in_seconds' => 0,
'date' => time(), 'date' => time(),
'should_sign_header' => null, 'should_sign_header' => null,
]; ];
} }
private $options; private $options;
public function __construct(array $options = []) { public function __construct(array $options = []) {
parent::__construct(); parent::__construct();
$this->options = $options = new Options($options, self::defaults()); $this->options = $options = new Options($options, self::defaults());
$sc = $this->acquire(self::$crt->signing_config_aws_new()); $sc = $this->acquire(self::$crt->signing_config_aws_new());
self::$crt->signing_config_aws_set_algorithm($sc, $options->algorithm->asInt()); self::$crt->signing_config_aws_set_algorithm($sc, $options->algorithm->asInt());
self::$crt->signing_config_aws_set_signature_type($sc, $options->signature_type->asInt()); self::$crt->signing_config_aws_set_signature_type($sc, $options->signature_type->asInt());
if ($credentials_provider = $options->credentials_provider->asObject()) { if ($credentials_provider = $options->credentials_provider->asObject()) {
self::$crt->signing_config_aws_set_credentials_provider( self::$crt->signing_config_aws_set_credentials_provider(
$sc, $sc,
$credentials_provider->native); $credentials_provider->native);
} }
self::$crt->signing_config_aws_set_region( self::$crt->signing_config_aws_set_region(
$sc, $options->region->asString()); $sc, $options->region->asString());
self::$crt->signing_config_aws_set_service( self::$crt->signing_config_aws_set_service(
$sc, $options->service->asString()); $sc, $options->service->asString());
self::$crt->signing_config_aws_set_use_double_uri_encode( self::$crt->signing_config_aws_set_use_double_uri_encode(
$sc, $options->use_double_uri_encode->asBool()); $sc, $options->use_double_uri_encode->asBool());
self::$crt->signing_config_aws_set_should_normalize_uri_path( self::$crt->signing_config_aws_set_should_normalize_uri_path(
$sc, $options->should_normalize_uri_path->asBool()); $sc, $options->should_normalize_uri_path->asBool());
self::$crt->signing_config_aws_set_omit_session_token( self::$crt->signing_config_aws_set_omit_session_token(
$sc, $options->omit_session_token->asBool()); $sc, $options->omit_session_token->asBool());
self::$crt->signing_config_aws_set_signed_body_value( self::$crt->signing_config_aws_set_signed_body_value(
$sc, $options->signed_body_value->asString()); $sc, $options->signed_body_value->asString());
self::$crt->signing_config_aws_set_signed_body_header_type( self::$crt->signing_config_aws_set_signed_body_header_type(
$sc, $options->signed_body_header_type->asInt()); $sc, $options->signed_body_header_type->asInt());
self::$crt->signing_config_aws_set_expiration_in_seconds( self::$crt->signing_config_aws_set_expiration_in_seconds(
$sc, $options->expiration_in_seconds->asInt()); $sc, $options->expiration_in_seconds->asInt());
self::$crt->signing_config_aws_set_date($sc, $options->date->asInt()); self::$crt->signing_config_aws_set_date($sc, $options->date->asInt());
if ($should_sign_header = $options->should_sign_header->asCallable()) { if ($should_sign_header = $options->should_sign_header->asCallable()) {
self::$crt->signing_config_aws_set_should_sign_header_fn($sc, $should_sign_header); self::$crt->signing_config_aws_set_should_sign_header_fn($sc, $should_sign_header);
} }
} }
function __destruct() function __destruct()
{ {
self::$crt->signing_config_aws_release($this->release()); self::$crt->signing_config_aws_release($this->release());
parent::__destruct(); parent::__destruct();
} }
public function __get($name) { public function __get($name) {
return $this->options->get($name); return $this->options->get($name);
} }
} }

View file

@ -1,33 +1,33 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT\Auth; namespace AWS\CRT\Auth;
use AWS\CRT\NativeResource; use AWS\CRT\NativeResource;
use AWS\CRT\HTTP\Request; use AWS\CRT\HTTP\Request;
class SigningResult extends NativeResource { class SigningResult extends NativeResource {
protected function __construct($native) { protected function __construct($native) {
parent::__construct(); parent::__construct();
$this->acquire($native); $this->acquire($native);
} }
function __destruct() { function __destruct() {
// No destruction necessary, SigningResults are transient, just release // No destruction necessary, SigningResults are transient, just release
$this->release(); $this->release();
parent::__destruct(); parent::__destruct();
} }
public static function fromNative($ptr) { public static function fromNative($ptr) {
return new SigningResult($ptr); return new SigningResult($ptr);
} }
public function applyToHttpRequest(&$http_request) { public function applyToHttpRequest(&$http_request) {
self::$crt->signing_result_apply_to_http_request($this->native, $http_request->native); self::$crt->signing_result_apply_to_http_request($this->native, $http_request->native);
// Update http_request from native // Update http_request from native
$http_request = Request::unmarshall($http_request->toBlob()); $http_request = Request::unmarshall($http_request->toBlob());
} }
} }

View file

@ -1,35 +1,35 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT\Auth; namespace AWS\CRT\Auth;
/** /**
* Provides a static set of AWS credentials * Provides a static set of AWS credentials
* *
* @param array options: * @param array options:
* - string access_key_id - AWS Access Key Id * - string access_key_id - AWS Access Key Id
* - string secret_access_key - AWS Secret Access Key * - string secret_access_key - AWS Secret Access Key
* - string session_token - Optional STS session token * - string session_token - Optional STS session token
*/ */
final class StaticCredentialsProvider extends CredentialsProvider { final class StaticCredentialsProvider extends CredentialsProvider {
private $credentials; private $credentials;
public function __get($name) { public function __get($name) {
return $this->$name; return $this->$name;
} }
function __construct(array $options = []) { function __construct(array $options = []) {
parent::__construct(); parent::__construct();
$this->credentials = new AwsCredentials($options); $this->credentials = new AwsCredentials($options);
$provider_options = self::$crt->credentials_provider_static_options_new(); $provider_options = self::$crt->credentials_provider_static_options_new();
self::$crt->credentials_provider_static_options_set_access_key_id($provider_options, $this->credentials->access_key_id); self::$crt->credentials_provider_static_options_set_access_key_id($provider_options, $this->credentials->access_key_id);
self::$crt->credentials_provider_static_options_set_secret_access_key($provider_options, $this->credentials->secret_access_key); self::$crt->credentials_provider_static_options_set_secret_access_key($provider_options, $this->credentials->secret_access_key);
self::$crt->credentials_provider_static_options_set_session_token($provider_options, $this->credentials->session_token); self::$crt->credentials_provider_static_options_set_session_token($provider_options, $this->credentials->session_token);
$this->acquire(self::$crt->credentials_provider_static_new($provider_options)); $this->acquire(self::$crt->credentials_provider_static_new($provider_options));
self::$crt->credentials_provider_static_options_release($provider_options); self::$crt->credentials_provider_static_options_release($provider_options);
} }
} }

View file

@ -1,358 +1,358 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT; namespace AWS\CRT;
use AWS\CRT\Internal\Extension; use AWS\CRT\Internal\Extension;
use \RuntimeException; use \RuntimeException;
/** /**
* Wrapper for the interface to the CRT. There only ever needs to be one of these, but * Wrapper for the interface to the CRT. There only ever needs to be one of these, but
* additional instances won't cost anything other than their memory. * additional instances won't cost anything other than their memory.
* Creating an instance of any NativeResource will activate the CRT binding. User code * Creating an instance of any NativeResource will activate the CRT binding. User code
* should only need to create one of these if they are only accessing CRT:: static functions. * should only need to create one of these if they are only accessing CRT:: static functions.
*/ */
final class CRT { final class CRT {
private static $impl = null; private static $impl = null;
private static $refcount = 0; private static $refcount = 0;
function __construct() { function __construct() {
if (is_null(self::$impl)) { if (is_null(self::$impl)) {
try { try {
self::$impl = new Extension(); self::$impl = new Extension();
} catch (RuntimeException $rex) { } catch (RuntimeException $rex) {
throw new RuntimeException("Unable to initialize AWS CRT via awscrt extension: \n$rex", -1); throw new RuntimeException("Unable to initialize AWS CRT via awscrt extension: \n$rex", -1);
} }
} }
++self::$refcount; ++self::$refcount;
} }
function __destruct() { function __destruct() {
if (--self::$refcount == 0) { if (--self::$refcount == 0) {
self::$impl = null; self::$impl = null;
} }
} }
/** /**
* @return bool whether or not the CRT is currently loaded * @return bool whether or not the CRT is currently loaded
*/ */
public static function isLoaded() { public static function isLoaded() {
return !is_null(self::$impl); return !is_null(self::$impl);
} }
/** /**
* @return bool whether or not the CRT is available via one of the possible backends * @return bool whether or not the CRT is available via one of the possible backends
*/ */
public static function isAvailable() { public static function isAvailable() {
try { try {
new CRT(); new CRT();
return true; return true;
} catch (RuntimeException $ex) { } catch (RuntimeException $ex) {
return false; return false;
} }
} }
/** /**
* @return integer last error code reported within the CRT * @return integer last error code reported within the CRT
*/ */
public static function last_error() { public static function last_error() {
return self::$impl->aws_crt_last_error(); return self::$impl->aws_crt_last_error();
} }
/** /**
* @param integer $error Error code from the CRT, usually delivered via callback or {@see last_error} * @param integer $error Error code from the CRT, usually delivered via callback or {@see last_error}
* @return string Human-readable description of the provided error code * @return string Human-readable description of the provided error code
*/ */
public static function error_str($error) { public static function error_str($error) {
return self::$impl->aws_crt_error_str((int) $error); return self::$impl->aws_crt_error_str((int) $error);
} }
/** /**
* @param integer $error Error code from the CRT, usually delivered via callback or {@see last_error} * @param integer $error Error code from the CRT, usually delivered via callback or {@see last_error}
* @return string Name/enum identifier for the provided error code * @return string Name/enum identifier for the provided error code
*/ */
public static function error_name($error) { public static function error_name($error) {
return self::$impl->aws_crt_error_name((int) $error); return self::$impl->aws_crt_error_name((int) $error);
} }
public static function log_to_stdout() { public static function log_to_stdout() {
return self::$impl->aws_crt_log_to_stdout(); return self::$impl->aws_crt_log_to_stdout();
} }
public static function log_to_stderr() { public static function log_to_stderr() {
return self::$impl->aws_crt_log_to_stderr(); return self::$impl->aws_crt_log_to_stderr();
} }
public static function log_to_file($filename) { public static function log_to_file($filename) {
return self::$impl->aws_crt_log_to_file($filename); return self::$impl->aws_crt_log_to_file($filename);
} }
public static function log_to_stream($stream) { public static function log_to_stream($stream) {
return self::$impl->aws_crt_log_to_stream($stream); return self::$impl->aws_crt_log_to_stream($stream);
} }
public static function log_set_level($level) { public static function log_set_level($level) {
return self::$impl->aws_crt_log_set_level($level); return self::$impl->aws_crt_log_set_level($level);
} }
public static function log_stop() { public static function log_stop() {
return self::$impl->aws_crt_log_stop(); return self::$impl->aws_crt_log_stop();
} }
public static function log_message($level, $message) { public static function log_message($level, $message) {
return self::$impl->aws_crt_log_message($level, $message); return self::$impl->aws_crt_log_message($level, $message);
} }
/** /**
* @return object Pointer to native event_loop_group_options * @return object Pointer to native event_loop_group_options
*/ */
function event_loop_group_options_new() { function event_loop_group_options_new() {
return self::$impl->aws_crt_event_loop_group_options_new(); return self::$impl->aws_crt_event_loop_group_options_new();
} }
/** /**
* @param object $elg_options Pointer to native event_loop_group_options * @param object $elg_options Pointer to native event_loop_group_options
*/ */
function event_loop_group_options_release($elg_options) { function event_loop_group_options_release($elg_options) {
self::$impl->aws_crt_event_loop_group_options_release($elg_options); self::$impl->aws_crt_event_loop_group_options_release($elg_options);
} }
/** /**
* @param object $elg_options Pointer to native event_loop_group_options * @param object $elg_options Pointer to native event_loop_group_options
* @param integer $max_threads Maximum number of threads to allow the event loop group to use, default: 0/1 per CPU core * @param integer $max_threads Maximum number of threads to allow the event loop group to use, default: 0/1 per CPU core
*/ */
function event_loop_group_options_set_max_threads($elg_options, $max_threads) { function event_loop_group_options_set_max_threads($elg_options, $max_threads) {
self::$impl->aws_crt_event_loop_group_options_set_max_threads($elg_options, (int)$max_threads); self::$impl->aws_crt_event_loop_group_options_set_max_threads($elg_options, (int)$max_threads);
} }
/** /**
* @param object Pointer to event_loop_group_options, {@see event_loop_group_options_new} * @param object Pointer to event_loop_group_options, {@see event_loop_group_options_new}
* @return object Pointer to the new event loop group * @return object Pointer to the new event loop group
*/ */
function event_loop_group_new($options) { function event_loop_group_new($options) {
return self::$impl->aws_crt_event_loop_group_new($options); return self::$impl->aws_crt_event_loop_group_new($options);
} }
/** /**
* @param object $elg Pointer to the event loop group to release * @param object $elg Pointer to the event loop group to release
*/ */
function event_loop_group_release($elg) { function event_loop_group_release($elg) {
self::$impl->aws_crt_event_loop_group_release($elg); self::$impl->aws_crt_event_loop_group_release($elg);
} }
/** /**
* return object Pointer to native AWS credentials options * return object Pointer to native AWS credentials options
*/ */
function aws_credentials_options_new() { function aws_credentials_options_new() {
return self::$impl->aws_crt_credentials_options_new(); return self::$impl->aws_crt_credentials_options_new();
} }
function aws_credentials_options_release($options) { function aws_credentials_options_release($options) {
self::$impl->aws_crt_credentials_options_release($options); self::$impl->aws_crt_credentials_options_release($options);
} }
function aws_credentials_options_set_access_key_id($options, $access_key_id) { function aws_credentials_options_set_access_key_id($options, $access_key_id) {
self::$impl->aws_crt_credentials_options_set_access_key_id($options, $access_key_id); self::$impl->aws_crt_credentials_options_set_access_key_id($options, $access_key_id);
} }
function aws_credentials_options_set_secret_access_key($options, $secret_access_key) { function aws_credentials_options_set_secret_access_key($options, $secret_access_key) {
self::$impl->aws_crt_credentials_options_set_secret_access_key($options, $secret_access_key); self::$impl->aws_crt_credentials_options_set_secret_access_key($options, $secret_access_key);
} }
function aws_credentials_options_set_session_token($options, $session_token) { function aws_credentials_options_set_session_token($options, $session_token) {
self::$impl->aws_crt_credentials_options_set_session_token($options, $session_token); self::$impl->aws_crt_credentials_options_set_session_token($options, $session_token);
} }
function aws_credentials_options_set_expiration_timepoint_seconds($options, $expiration_timepoint_seconds) { function aws_credentials_options_set_expiration_timepoint_seconds($options, $expiration_timepoint_seconds) {
self::$impl->aws_crt_credentials_options_set_expiration_timepoint_seconds($options, $expiration_timepoint_seconds); self::$impl->aws_crt_credentials_options_set_expiration_timepoint_seconds($options, $expiration_timepoint_seconds);
} }
function aws_credentials_new($options) { function aws_credentials_new($options) {
return self::$impl->aws_crt_credentials_new($options); return self::$impl->aws_crt_credentials_new($options);
} }
function aws_credentials_release($credentials) { function aws_credentials_release($credentials) {
self::$impl->aws_crt_credentials_release($credentials); self::$impl->aws_crt_credentials_release($credentials);
} }
function credentials_provider_release($provider) { function credentials_provider_release($provider) {
self::$impl->aws_crt_credentials_provider_release($provider); self::$impl->aws_crt_credentials_provider_release($provider);
} }
function credentials_provider_static_options_new() { function credentials_provider_static_options_new() {
return self::$impl->aws_crt_credentials_provider_static_options_new(); return self::$impl->aws_crt_credentials_provider_static_options_new();
} }
function credentials_provider_static_options_release($options) { function credentials_provider_static_options_release($options) {
self::$impl->aws_crt_credentials_provider_static_options_release($options); self::$impl->aws_crt_credentials_provider_static_options_release($options);
} }
function credentials_provider_static_options_set_access_key_id($options, $access_key_id) { function credentials_provider_static_options_set_access_key_id($options, $access_key_id) {
self::$impl->aws_crt_credentials_provider_static_options_set_access_key_id($options, $access_key_id); self::$impl->aws_crt_credentials_provider_static_options_set_access_key_id($options, $access_key_id);
} }
function credentials_provider_static_options_set_secret_access_key($options, $secret_access_key) { function credentials_provider_static_options_set_secret_access_key($options, $secret_access_key) {
self::$impl->aws_crt_credentials_provider_static_options_set_secret_access_key($options, $secret_access_key); self::$impl->aws_crt_credentials_provider_static_options_set_secret_access_key($options, $secret_access_key);
} }
function credentials_provider_static_options_set_session_token($options, $session_token) { function credentials_provider_static_options_set_session_token($options, $session_token) {
self::$impl->aws_crt_credentials_provider_static_options_set_session_token($options, $session_token); self::$impl->aws_crt_credentials_provider_static_options_set_session_token($options, $session_token);
} }
function credentials_provider_static_new($options) { function credentials_provider_static_new($options) {
return self::$impl->aws_crt_credentials_provider_static_new($options); return self::$impl->aws_crt_credentials_provider_static_new($options);
} }
function input_stream_options_new() { function input_stream_options_new() {
return self::$impl->aws_crt_input_stream_options_new(); return self::$impl->aws_crt_input_stream_options_new();
} }
function input_stream_options_release($options) { function input_stream_options_release($options) {
self::$impl->aws_crt_input_stream_options_release($options); self::$impl->aws_crt_input_stream_options_release($options);
} }
function input_stream_options_set_user_data($options, $user_data) { function input_stream_options_set_user_data($options, $user_data) {
self::$impl->aws_crt_input_stream_options_set_user_data($options, $user_data); self::$impl->aws_crt_input_stream_options_set_user_data($options, $user_data);
} }
function input_stream_new($options) { function input_stream_new($options) {
return self::$impl->aws_crt_input_stream_new($options); return self::$impl->aws_crt_input_stream_new($options);
} }
function input_stream_release($stream) { function input_stream_release($stream) {
self::$impl->aws_crt_input_stream_release($stream); self::$impl->aws_crt_input_stream_release($stream);
} }
function input_stream_seek($stream, $offset, $basis) { function input_stream_seek($stream, $offset, $basis) {
return self::$impl->aws_crt_input_stream_seek($stream, $offset, $basis); return self::$impl->aws_crt_input_stream_seek($stream, $offset, $basis);
} }
function input_stream_read($stream, $length) { function input_stream_read($stream, $length) {
return self::$impl->aws_crt_input_stream_read($stream, $length); return self::$impl->aws_crt_input_stream_read($stream, $length);
} }
function input_stream_eof($stream) { function input_stream_eof($stream) {
return self::$impl->aws_crt_input_stream_eof($stream); return self::$impl->aws_crt_input_stream_eof($stream);
} }
function input_stream_get_length($stream) { function input_stream_get_length($stream) {
return self::$impl->aws_crt_input_stream_get_length($stream); return self::$impl->aws_crt_input_stream_get_length($stream);
} }
function http_message_new_from_blob($blob) { function http_message_new_from_blob($blob) {
return self::$impl->aws_crt_http_message_new_from_blob($blob); return self::$impl->aws_crt_http_message_new_from_blob($blob);
} }
function http_message_to_blob($message) { function http_message_to_blob($message) {
return self::$impl->aws_crt_http_message_to_blob($message); return self::$impl->aws_crt_http_message_to_blob($message);
} }
function http_message_release($message) { function http_message_release($message) {
self::$impl->aws_crt_http_message_release($message); self::$impl->aws_crt_http_message_release($message);
} }
function signing_config_aws_new() { function signing_config_aws_new() {
return self::$impl->aws_crt_signing_config_aws_new(); return self::$impl->aws_crt_signing_config_aws_new();
} }
function signing_config_aws_release($signing_config) { function signing_config_aws_release($signing_config) {
return self::$impl->aws_crt_signing_config_aws_release($signing_config); return self::$impl->aws_crt_signing_config_aws_release($signing_config);
} }
function signing_config_aws_set_algorithm($signing_config, $algorithm) { function signing_config_aws_set_algorithm($signing_config, $algorithm) {
self::$impl->aws_crt_signing_config_aws_set_algorithm($signing_config, (int)$algorithm); self::$impl->aws_crt_signing_config_aws_set_algorithm($signing_config, (int)$algorithm);
} }
function signing_config_aws_set_signature_type($signing_config, $signature_type) { function signing_config_aws_set_signature_type($signing_config, $signature_type) {
self::$impl->aws_crt_signing_config_aws_set_signature_type($signing_config, (int)$signature_type); self::$impl->aws_crt_signing_config_aws_set_signature_type($signing_config, (int)$signature_type);
} }
function signing_config_aws_set_credentials_provider($signing_config, $credentials_provider) { function signing_config_aws_set_credentials_provider($signing_config, $credentials_provider) {
self::$impl->aws_crt_signing_config_aws_set_credentials_provider($signing_config, $credentials_provider); self::$impl->aws_crt_signing_config_aws_set_credentials_provider($signing_config, $credentials_provider);
} }
function signing_config_aws_set_region($signing_config, $region) { function signing_config_aws_set_region($signing_config, $region) {
self::$impl->aws_crt_signing_config_aws_set_region($signing_config, $region); self::$impl->aws_crt_signing_config_aws_set_region($signing_config, $region);
} }
function signing_config_aws_set_service($signing_config, $service) { function signing_config_aws_set_service($signing_config, $service) {
self::$impl->aws_crt_signing_config_aws_set_service($signing_config, $service); self::$impl->aws_crt_signing_config_aws_set_service($signing_config, $service);
} }
function signing_config_aws_set_use_double_uri_encode($signing_config, $use_double_uri_encode) { function signing_config_aws_set_use_double_uri_encode($signing_config, $use_double_uri_encode) {
self::$impl->aws_crt_signing_config_aws_set_use_double_uri_encode($signing_config, $use_double_uri_encode); self::$impl->aws_crt_signing_config_aws_set_use_double_uri_encode($signing_config, $use_double_uri_encode);
} }
function signing_config_aws_set_should_normalize_uri_path($signing_config, $should_normalize_uri_path) { function signing_config_aws_set_should_normalize_uri_path($signing_config, $should_normalize_uri_path) {
self::$impl->aws_crt_signing_config_aws_set_should_normalize_uri_path($signing_config, $should_normalize_uri_path); self::$impl->aws_crt_signing_config_aws_set_should_normalize_uri_path($signing_config, $should_normalize_uri_path);
} }
function signing_config_aws_set_omit_session_token($signing_config, $omit_session_token) { function signing_config_aws_set_omit_session_token($signing_config, $omit_session_token) {
self::$impl->aws_crt_signing_config_aws_set_omit_session_token($signing_config, $omit_session_token); self::$impl->aws_crt_signing_config_aws_set_omit_session_token($signing_config, $omit_session_token);
} }
function signing_config_aws_set_signed_body_value($signing_config, $signed_body_value) { function signing_config_aws_set_signed_body_value($signing_config, $signed_body_value) {
self::$impl->aws_crt_signing_config_aws_set_signed_body_value($signing_config, $signed_body_value); self::$impl->aws_crt_signing_config_aws_set_signed_body_value($signing_config, $signed_body_value);
} }
function signing_config_aws_set_signed_body_header_type($signing_config, $signed_body_header_type) { function signing_config_aws_set_signed_body_header_type($signing_config, $signed_body_header_type) {
self::$impl->aws_crt_signing_config_aws_set_signed_body_header_type($signing_config, $signed_body_header_type); self::$impl->aws_crt_signing_config_aws_set_signed_body_header_type($signing_config, $signed_body_header_type);
} }
function signing_config_aws_set_expiration_in_seconds($signing_config, $expiration_in_seconds) { function signing_config_aws_set_expiration_in_seconds($signing_config, $expiration_in_seconds) {
self::$impl->aws_crt_signing_config_aws_set_expiration_in_seconds($signing_config, $expiration_in_seconds); self::$impl->aws_crt_signing_config_aws_set_expiration_in_seconds($signing_config, $expiration_in_seconds);
} }
function signing_config_aws_set_date($signing_config, $timestamp) { function signing_config_aws_set_date($signing_config, $timestamp) {
self::$impl->aws_crt_signing_config_aws_set_date($signing_config, $timestamp); self::$impl->aws_crt_signing_config_aws_set_date($signing_config, $timestamp);
} }
function signing_config_aws_set_should_sign_header_fn($signing_config, $should_sign_header_fn) { function signing_config_aws_set_should_sign_header_fn($signing_config, $should_sign_header_fn) {
self::$impl->aws_crt_signing_config_aws_set_should_sign_header_fn($signing_config, $should_sign_header_fn); self::$impl->aws_crt_signing_config_aws_set_should_sign_header_fn($signing_config, $should_sign_header_fn);
} }
function signable_new_from_http_request($http_message) { function signable_new_from_http_request($http_message) {
return self::$impl->aws_crt_signable_new_from_http_request($http_message); return self::$impl->aws_crt_signable_new_from_http_request($http_message);
} }
function signable_new_from_chunk($chunk_stream, $previous_signature) { function signable_new_from_chunk($chunk_stream, $previous_signature) {
return self::$impl->aws_crt_signable_new_from_chunk($chunk_stream, $previous_signature); return self::$impl->aws_crt_signable_new_from_chunk($chunk_stream, $previous_signature);
} }
function signable_new_from_canonical_request($canonical_request) { function signable_new_from_canonical_request($canonical_request) {
return self::$impl->aws_crt_signable_new_from_canonical_request($canonical_request); return self::$impl->aws_crt_signable_new_from_canonical_request($canonical_request);
} }
function signable_release($signable) { function signable_release($signable) {
self::$impl->aws_crt_signable_release($signable); self::$impl->aws_crt_signable_release($signable);
} }
function signing_result_release($signing_result) { function signing_result_release($signing_result) {
self::$impl->aws_crt_signing_result_release($signing_result); self::$impl->aws_crt_signing_result_release($signing_result);
} }
function signing_result_apply_to_http_request($signing_result, $http_message) { function signing_result_apply_to_http_request($signing_result, $http_message) {
return self::$impl->aws_crt_signing_result_apply_to_http_request( return self::$impl->aws_crt_signing_result_apply_to_http_request(
$signing_result, $http_message); $signing_result, $http_message);
} }
function sign_request_aws($signable, $signing_config, $on_complete, $user_data) { function sign_request_aws($signable, $signing_config, $on_complete, $user_data) {
return self::$impl->aws_crt_sign_request_aws($signable, $signing_config, $on_complete, $user_data); return self::$impl->aws_crt_sign_request_aws($signable, $signing_config, $on_complete, $user_data);
} }
function test_verify_sigv4a_signing($signable, $signing_config, $expected_canonical_request, $signature, $ecc_key_pub_x, $ecc_key_pub_y) { function test_verify_sigv4a_signing($signable, $signing_config, $expected_canonical_request, $signature, $ecc_key_pub_x, $ecc_key_pub_y) {
return self::$impl->aws_crt_test_verify_sigv4a_signing($signable, $signing_config, $expected_canonical_request, $signature, $ecc_key_pub_x, $ecc_key_pub_y); return self::$impl->aws_crt_test_verify_sigv4a_signing($signable, $signing_config, $expected_canonical_request, $signature, $ecc_key_pub_x, $ecc_key_pub_y);
} }
public static function crc32($input, $previous = 0) { public static function crc32($input, $previous = 0) {
return self::$impl->aws_crt_crc32($input, $previous); return self::$impl->aws_crt_crc32($input, $previous);
} }
public static function crc32c($input, $previous = 0) { public static function crc32c($input, $previous = 0) {
return self::$impl->aws_crt_crc32c($input, $previous); return self::$impl->aws_crt_crc32c($input, $previous);
} }
} }

View file

@ -1,50 +1,50 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT\HTTP; namespace AWS\CRT\HTTP;
use AWS\CRT\Internal\Encoding; use AWS\CRT\Internal\Encoding;
final class Headers { final class Headers {
private $headers; private $headers;
public function __construct($headers = []) { public function __construct($headers = []) {
$this->headers = $headers; $this->headers = $headers;
} }
public static function marshall($headers) { public static function marshall($headers) {
$buf = ""; $buf = "";
foreach ($headers->headers as $header => $value) { foreach ($headers->headers as $header => $value) {
$buf .= Encoding::encodeString($header); $buf .= Encoding::encodeString($header);
$buf .= Encoding::encodeString($value); $buf .= Encoding::encodeString($value);
} }
return $buf; return $buf;
} }
public static function unmarshall($buf) { public static function unmarshall($buf) {
$strings = Encoding::readStrings($buf); $strings = Encoding::readStrings($buf);
$headers = []; $headers = [];
for ($idx = 0; $idx < count($strings);) { for ($idx = 0; $idx < count($strings);) {
$headers[$strings[$idx++]] = $strings[$idx++]; $headers[$strings[$idx++]] = $strings[$idx++];
} }
return new Headers($headers); return new Headers($headers);
} }
public function count() { public function count() {
return count($this->headers); return count($this->headers);
} }
public function get($header) { public function get($header) {
return isset($this->headers[$header]) ? $this->headers[$header] : null; return isset($this->headers[$header]) ? $this->headers[$header] : null;
} }
public function set($header, $value) { public function set($header, $value) {
$this->headers[$header] = $value; $this->headers[$header] = $value;
} }
public function toArray() { public function toArray() {
return $this->headers; return $this->headers;
} }
} }

View file

@ -1,95 +1,95 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT\HTTP; namespace AWS\CRT\HTTP;
use AWS\CRT\NativeResource; use AWS\CRT\NativeResource;
use AWS\CRT\Internal\Encoding; use AWS\CRT\Internal\Encoding;
abstract class Message extends NativeResource { abstract class Message extends NativeResource {
private $method; private $method;
private $path; private $path;
private $query; private $query;
private $headers; private $headers;
public function __construct($method, $path, $query = [], $headers = []) { public function __construct($method, $path, $query = [], $headers = []) {
parent::__construct(); parent::__construct();
$this->method = $method; $this->method = $method;
$this->path = $path; $this->path = $path;
$this->query = $query; $this->query = $query;
$this->headers = new Headers($headers); $this->headers = new Headers($headers);
$this->acquire(self::$crt->http_message_new_from_blob(self::marshall($this))); $this->acquire(self::$crt->http_message_new_from_blob(self::marshall($this)));
} }
public function __destruct() { public function __destruct() {
self::$crt->http_message_release($this->release()); self::$crt->http_message_release($this->release());
parent::__destruct(); parent::__destruct();
} }
public function toBlob() { public function toBlob() {
return self::$crt->http_message_to_blob($this->native); return self::$crt->http_message_to_blob($this->native);
} }
protected static function marshall($msg) { protected static function marshall($msg) {
$buf = ""; $buf = "";
$buf .= Encoding::encodeString($msg->method); $buf .= Encoding::encodeString($msg->method);
$buf .= Encoding::encodeString($msg->pathAndQuery()); $buf .= Encoding::encodeString($msg->pathAndQuery());
$buf .= Headers::marshall($msg->headers); $buf .= Headers::marshall($msg->headers);
return $buf; return $buf;
} }
protected static function _unmarshall($buf, $class=Message::class) { protected static function _unmarshall($buf, $class=Message::class) {
$method = Encoding::readString($buf); $method = Encoding::readString($buf);
$path_and_query = Encoding::readString($buf); $path_and_query = Encoding::readString($buf);
$parts = explode("?", $path_and_query, 2); $parts = explode("?", $path_and_query, 2);
$path = isset($parts[0]) ? $parts[0] : ""; $path = isset($parts[0]) ? $parts[0] : "";
$query = isset($parts[1]) ? $parts[1] : ""; $query = isset($parts[1]) ? $parts[1] : "";
$headers = Headers::unmarshall($buf); $headers = Headers::unmarshall($buf);
// Turn query params back into a dictionary // Turn query params back into a dictionary
if (strlen($query)) { if (strlen($query)) {
$query = rawurldecode($query); $query = rawurldecode($query);
$query = explode("&", $query); $query = explode("&", $query);
$query = array_reduce($query, function($params, $pair) { $query = array_reduce($query, function($params, $pair) {
list($param, $value) = explode("=", $pair, 2); list($param, $value) = explode("=", $pair, 2);
$params[$param] = $value; $params[$param] = $value;
return $params; return $params;
}, []); }, []);
} else { } else {
$query = []; $query = [];
} }
return new $class($method, $path, $query, $headers->toArray()); return new $class($method, $path, $query, $headers->toArray());
} }
public function pathAndQuery() { public function pathAndQuery() {
$path = $this->path; $path = $this->path;
$queries = []; $queries = [];
foreach ($this->query as $param => $value) { foreach ($this->query as $param => $value) {
$queries []= urlencode($param) . "=" . urlencode($value); $queries []= urlencode($param) . "=" . urlencode($value);
} }
$query = implode("&", $queries); $query = implode("&", $queries);
if (strlen($query)) { if (strlen($query)) {
$path = implode("?", [$path, $query]); $path = implode("?", [$path, $query]);
} }
return $path; return $path;
} }
public function method() { public function method() {
return $this->method; return $this->method;
} }
public function path() { public function path() {
return $this->path; return $this->path;
} }
public function query() { public function query() {
return $this->query; return $this->query;
} }
public function headers() { public function headers() {
return $this->headers; return $this->headers;
} }
} }

View file

@ -1,32 +1,32 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT\HTTP; namespace AWS\CRT\HTTP;
use AWS\CRT\IO\InputStream; use AWS\CRT\IO\InputStream;
class Request extends Message { class Request extends Message {
private $body_stream = null; private $body_stream = null;
public function __construct($method, $path, $query = [], $headers = [], $body_stream = null) { public function __construct($method, $path, $query = [], $headers = [], $body_stream = null) {
parent::__construct($method, $path, $query, $headers); parent::__construct($method, $path, $query, $headers);
if (!is_null($body_stream) && !($body_stream instanceof InputStream)) { if (!is_null($body_stream) && !($body_stream instanceof InputStream)) {
throw InvalidArgumentException('body_stream must be an instance of ' . InputStream::class); throw InvalidArgumentException('body_stream must be an instance of ' . InputStream::class);
} }
$this->body_stream = $body_stream; $this->body_stream = $body_stream;
} }
public static function marshall($request) { public static function marshall($request) {
return parent::marshall($request); return parent::marshall($request);
} }
public static function unmarshall($buf) { public static function unmarshall($buf) {
return parent::_unmarshall($buf, Request::class); return parent::_unmarshall($buf, Request::class);
} }
public function body_stream() { public function body_stream() {
return $this->body_stream; return $this->body_stream;
} }
} }

View file

@ -1,27 +1,27 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT\HTTP; namespace AWS\CRT\HTTP;
class Response extends Message { class Response extends Message {
private $status_code; private $status_code;
public function __construct($method, $path, $query, $headers, $status_code) { public function __construct($method, $path, $query, $headers, $status_code) {
parent::__construct($method, $path, $query, $headers); parent::__construct($method, $path, $query, $headers);
$this->status_code = $status_code; $this->status_code = $status_code;
} }
public static function marshall($response) { public static function marshall($response) {
return parent::marshall($response); return parent::marshall($response);
} }
public static function unmarshall($buf) { public static function unmarshall($buf) {
return parent::_unmarshall($buf, Response::class); return parent::_unmarshall($buf, Response::class);
} }
public function status_code() { public function status_code() {
return $this->status_code; return $this->status_code;
} }
} }

View file

@ -1,39 +1,39 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT\IO; namespace AWS\CRT\IO;
use AWS\CRT\NativeResource as NativeResource; use AWS\CRT\NativeResource as NativeResource;
use AWS\CRT\Options as Options; use AWS\CRT\Options as Options;
/** /**
* Represents 1 or more event loops (1 per thread) for doing I/O and background tasks. * Represents 1 or more event loops (1 per thread) for doing I/O and background tasks.
* Typically, every application has one EventLoopGroup. * Typically, every application has one EventLoopGroup.
* *
* @param array options: * @param array options:
* - int num_threads - Number of worker threads in the EventLoopGroup. Defaults to 0/1 per logical core. * - int num_threads - Number of worker threads in the EventLoopGroup. Defaults to 0/1 per logical core.
*/ */
final class EventLoopGroup extends NativeResource { final class EventLoopGroup extends NativeResource {
static function defaults() { static function defaults() {
return [ return [
'max_threads' => 0, 'max_threads' => 0,
]; ];
} }
function __construct(array $options = []) { function __construct(array $options = []) {
parent::__construct(); parent::__construct();
$options = new Options($options, self::defaults()); $options = new Options($options, self::defaults());
$elg_options = self::$crt->event_loop_group_options_new(); $elg_options = self::$crt->event_loop_group_options_new();
self::$crt->event_loop_group_options_set_max_threads($elg_options, $options->getInt('max_threads')); self::$crt->event_loop_group_options_set_max_threads($elg_options, $options->getInt('max_threads'));
$this->acquire(self::$crt->event_loop_group_new($elg_options)); $this->acquire(self::$crt->event_loop_group_new($elg_options));
self::$crt->event_loop_group_options_release($elg_options); self::$crt->event_loop_group_options_release($elg_options);
} }
function __destruct() { function __destruct() {
self::$crt->event_loop_group_release($this->release()); self::$crt->event_loop_group_release($this->release());
parent::__destruct(); parent::__destruct();
} }
} }

View file

@ -1,49 +1,49 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT\IO; namespace AWS\CRT\IO;
use AWS\CRT\NativeResource as NativeResource; use AWS\CRT\NativeResource as NativeResource;
final class InputStream extends NativeResource { final class InputStream extends NativeResource {
private $stream = null; private $stream = null;
const SEEK_BEGIN = 0; const SEEK_BEGIN = 0;
const SEEK_END = 2; const SEEK_END = 2;
public function __construct($stream) { public function __construct($stream) {
$this->stream = $stream; $this->stream = $stream;
$options = self::$crt->input_stream_options_new(); $options = self::$crt->input_stream_options_new();
// The stream implementation in native just converts the PHP stream into // The stream implementation in native just converts the PHP stream into
// a native php_stream* and executes operations entirely in native // a native php_stream* and executes operations entirely in native
self::$crt->input_stream_options_set_user_data($options, $stream); self::$crt->input_stream_options_set_user_data($options, $stream);
$this->acquire(self::$crt->input_stream_new($options)); $this->acquire(self::$crt->input_stream_new($options));
self::$crt->input_stream_options_release($options); self::$crt->input_stream_options_release($options);
} }
public function __destruct() { public function __destruct() {
self::$crt->input_stream_release($this->release()); self::$crt->input_stream_release($this->release());
parent::__destruct(); parent::__destruct();
} }
public function eof() { public function eof() {
return self::$crt->input_stream_eof($this->native); return self::$crt->input_stream_eof($this->native);
} }
public function length() { public function length() {
return self::$crt->input_stream_get_length($this->native); return self::$crt->input_stream_get_length($this->native);
} }
public function read($length = 0) { public function read($length = 0) {
if ($length == 0) { if ($length == 0) {
$length = $this->length(); $length = $this->length();
} }
return self::$crt->input_stream_read($this->native, $length); return self::$crt->input_stream_read($this->native, $length);
} }
public function seek($offset, $basis) { public function seek($offset, $basis) {
return self::$crt->input_stream_seek($this->native, $offset, $basis); return self::$crt->input_stream_seek($this->native, $offset, $basis);
} }
} }

View file

@ -1,37 +1,37 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT\Internal; namespace AWS\CRT\Internal;
final class Encoding { final class Encoding {
public static function readString(&$buffer) { public static function readString(&$buffer) {
list($len, $str) = self::decodeString($buffer); list($len, $str) = self::decodeString($buffer);
// Advance by sizeof(length) + strlen(str) // Advance by sizeof(length) + strlen(str)
$buffer = substr($buffer, 4 + $len); $buffer = substr($buffer, 4 + $len);
return $str; return $str;
} }
public static function readStrings($buffer) { public static function readStrings($buffer) {
$strings = []; $strings = [];
while (strlen($buffer)) { while (strlen($buffer)) {
$strings []= self::readString($buffer); $strings []= self::readString($buffer);
} }
return $strings; return $strings;
} }
public static function decodeString($buffer) { public static function decodeString($buffer) {
$len = unpack("N", $buffer)[1]; $len = unpack("N", $buffer)[1];
$buffer = substr($buffer, 4); $buffer = substr($buffer, 4);
$str = unpack("a${len}", $buffer)[1]; $str = unpack("a${len}", $buffer)[1];
return [$len, $str]; return [$len, $str];
} }
public static function encodeString($str) { public static function encodeString($str) {
if (is_array($str)) { if (is_array($str)) {
$str = $str[0]; $str = $str[0];
} }
return pack("Na*", strlen($str), $str); return pack("Na*", strlen($str), $str);
} }
} }

View file

@ -1,29 +1,29 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT\Internal; namespace AWS\CRT\Internal;
use \RuntimeException; use \RuntimeException;
/** /**
* @internal * @internal
* Forwards calls on to awscrt PHP extension functions * Forwards calls on to awscrt PHP extension functions
*/ */
final class Extension { final class Extension {
function __construct() { function __construct() {
if (!extension_loaded('awscrt')) { if (!extension_loaded('awscrt')) {
throw new RuntimeException('awscrt extension is not loaded'); throw new RuntimeException('awscrt extension is not loaded');
} }
} }
/** /**
* Forwards any call made on this object to the extension function of the * Forwards any call made on this object to the extension function of the
* same name with the supplied arguments. Argument type hinting and checking * same name with the supplied arguments. Argument type hinting and checking
* occurs at the CRT wrapper. * occurs at the CRT wrapper.
*/ */
function __call($name, $args) { function __call($name, $args) {
return call_user_func_array($name, $args); return call_user_func_array($name, $args);
} }
} }

View file

@ -1,47 +1,47 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT; namespace AWS\CRT;
use AWS\CRT\CRT; use AWS\CRT\CRT;
final class Log { final class Log {
const NONE = 0; const NONE = 0;
const FATAL = 1; const FATAL = 1;
const ERROR = 2; const ERROR = 2;
const WARN = 3; const WARN = 3;
const INFO = 4; const INFO = 4;
const DEBUG = 5; const DEBUG = 5;
const TRACE = 6; const TRACE = 6;
public static function toStdout() { public static function toStdout() {
CRT::log_to_stdout(); CRT::log_to_stdout();
} }
public static function toStderr() { public static function toStderr() {
CRT::log_to_stderr(); CRT::log_to_stderr();
} }
public static function toFile($filename) { public static function toFile($filename) {
CRT::log_to_file($filename); CRT::log_to_file($filename);
} }
public static function toStream($stream) { public static function toStream($stream) {
assert(get_resource_type($stream) == "stream"); assert(get_resource_type($stream) == "stream");
CRT::log_to_stream($stream); CRT::log_to_stream($stream);
} }
public static function stop() { public static function stop() {
CRT::log_stop(); CRT::log_stop();
} }
public static function setLogLevel($level) { public static function setLogLevel($level) {
assert($level >= self::NONE && $level <= self::TRACE); assert($level >= self::NONE && $level <= self::TRACE);
CRT::log_set_level($level); CRT::log_set_level($level);
} }
public static function log($level, $message) { public static function log($level, $message) {
CRT::log_message($level, $message); CRT::log_message($level, $message);
} }
} }

View file

@ -1,42 +1,42 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT; namespace AWS\CRT;
use AWS\CRT\CRT as CRT; use AWS\CRT\CRT as CRT;
/** /**
* Base class for all native resources, tracks all outstanding resources * Base class for all native resources, tracks all outstanding resources
* and provides basic leak checking * and provides basic leak checking
*/ */
abstract class NativeResource { abstract class NativeResource {
protected static $crt = null; protected static $crt = null;
protected static $resources = []; protected static $resources = [];
protected $native = null; protected $native = null;
protected function __construct() { protected function __construct() {
if (is_null(self::$crt)) { if (is_null(self::$crt)) {
self::$crt = new CRT(); self::$crt = new CRT();
} }
self::$resources[spl_object_hash($this)] = 1; self::$resources[spl_object_hash($this)] = 1;
} }
protected function acquire($handle) { protected function acquire($handle) {
return $this->native = $handle; return $this->native = $handle;
} }
protected function release() { protected function release() {
$native = $this->native; $native = $this->native;
$this->native = null; $this->native = null;
return $native; return $native;
} }
function __destruct() { function __destruct() {
// Should have been destroyed and released by derived resource // Should have been destroyed and released by derived resource
assert($this->native == null); assert($this->native == null);
unset(self::$resources[spl_object_hash($this)]); unset(self::$resources[spl_object_hash($this)]);
} }
} }

View file

@ -1,77 +1,77 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
namespace AWS\CRT; namespace AWS\CRT;
final class OptionValue { final class OptionValue {
private $value; private $value;
function __construct($value) { function __construct($value) {
$this->value = $value; $this->value = $value;
} }
public function asObject() { public function asObject() {
return $this->value; return $this->value;
} }
public function asMixed() { public function asMixed() {
return $this->value; return $this->value;
} }
public function asInt() { public function asInt() {
return empty($this->value) ? 0 : (int)$this->value; return empty($this->value) ? 0 : (int)$this->value;
} }
public function asBool() { public function asBool() {
return boolval($this->value); return boolval($this->value);
} }
public function asString() { public function asString() {
return !empty($this->value) ? strval($this->value) : ""; return !empty($this->value) ? strval($this->value) : "";
} }
public function asArray() { public function asArray() {
return is_array($this->value) ? $this->value : (!empty($this->value) ? [$this->value] : []); return is_array($this->value) ? $this->value : (!empty($this->value) ? [$this->value] : []);
} }
public function asCallable() { public function asCallable() {
return is_callable($this->value) ? $this->value : null; return is_callable($this->value) ? $this->value : null;
} }
} }
final class Options { final class Options {
private $options; private $options;
public function __construct($opts = [], $defaults = []) { public function __construct($opts = [], $defaults = []) {
$this->options = array_replace($defaults, empty($opts) ? [] : $opts); $this->options = array_replace($defaults, empty($opts) ? [] : $opts);
} }
public function __get($name) { public function __get($name) {
return $this->get($name); return $this->get($name);
} }
public function asArray() { public function asArray() {
return $this->options; return $this->options;
} }
public function toArray() { public function toArray() {
return array_merge_recursive([], $this->options); return array_merge_recursive([], $this->options);
} }
public function get($name) { public function get($name) {
return new OptionValue($this->options[$name]); return new OptionValue($this->options[$name]);
} }
public function getInt($name) { public function getInt($name) {
return $this->get($name)->asInt(); return $this->get($name)->asInt();
} }
public function getString($name) { public function getString($name) {
return $this->get($name)->asString(); return $this->get($name)->asString();
} }
public function getBool($name) { public function getBool($name) {
return $this->get($name)->asBool(); return $this->get($name)->asBool();
} }
} }

View file

@ -1,22 +1,22 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
use AWS\CRT\CRT; use AWS\CRT\CRT;
require_once('common.inc'); require_once('common.inc');
// This intentionally does not inherit from CrtTestCase because it needs a clean-room environment // This intentionally does not inherit from CrtTestCase because it needs a clean-room environment
final class CoreTest extends PHPUnit_Framework_TestCase { final class CoreTest extends PHPUnit_Framework_TestCase {
// The CRT should always be available in this test suite // The CRT should always be available in this test suite
public function testIsAvailable() { public function testIsAvailable() {
$this->assertTrue(CRT::isAvailable()); $this->assertTrue(CRT::isAvailable());
} }
// We have done nothing to necessitate loading the CRT, it should not be loaded // We have done nothing to necessitate loading the CRT, it should not be loaded
public function testIsLoaded() { public function testIsLoaded() {
$this->assertTrue(!CRT::isLoaded()); $this->assertTrue(!CRT::isLoaded());
} }
} }

View file

@ -1,90 +1,90 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
use AWS\CRT\CRT; use AWS\CRT\CRT;
require_once('common.inc'); require_once('common.inc');
final class CrcTest extends CrtTestCase { final class CrcTest extends CrtTestCase {
public function testCrc32ZeroesOneShot() { public function testCrc32ZeroesOneShot() {
$input = implode(array_map("chr", array_fill(0, 32, 0))); $input = implode(array_map("chr", array_fill(0, 32, 0)));
$output = CRT::crc32($input); $output = CRT::crc32($input);
$expected = 0x190A55AD; $expected = 0x190A55AD;
$this->assertEquals($output, $expected); $this->assertEquals($output, $expected);
} }
public function testCrc32ZeroesIterated() { public function testCrc32ZeroesIterated() {
$output = 0; $output = 0;
for ($i = 0; $i < 32; $i++) { for ($i = 0; $i < 32; $i++) {
$output = CRT::crc32("\x00", $output); $output = CRT::crc32("\x00", $output);
} }
$expected = 0x190A55AD; $expected = 0x190A55AD;
$this->assertEquals($output, $expected); $this->assertEquals($output, $expected);
} }
public function testCrc32ValuesOneShot() { public function testCrc32ValuesOneShot() {
$input = implode(array_map("chr", range(0, 31))); $input = implode(array_map("chr", range(0, 31)));
$output = CRT::crc32($input); $output = CRT::crc32($input);
$expected = 0x91267E8A; $expected = 0x91267E8A;
$this->assertEquals($output, $expected); $this->assertEquals($output, $expected);
} }
public function testCrc32ValuesIterated() { public function testCrc32ValuesIterated() {
$output = 0; $output = 0;
foreach (range(0, 31) as $n) { foreach (range(0, 31) as $n) {
$output = CRT::crc32(chr($n), $output); $output = CRT::crc32(chr($n), $output);
} }
$expected = 0x91267E8A; $expected = 0x91267E8A;
$this->assertEquals($output, $expected); $this->assertEquals($output, $expected);
} }
public function testCrc32LargeBuffer() { public function testCrc32LargeBuffer() {
$input = implode(array_map("chr", array_fill(0, 1 << 20, 0))); $input = implode(array_map("chr", array_fill(0, 1 << 20, 0)));
$output = CRT::crc32($input); $output = CRT::crc32($input);
$expected = 0xA738EA1C; $expected = 0xA738EA1C;
$this->assertEquals($output, $expected); $this->assertEquals($output, $expected);
} }
public function testCrc32cZeroesOneShot() { public function testCrc32cZeroesOneShot() {
$input = implode(array_map("chr", array_fill(0, 32, 0))); $input = implode(array_map("chr", array_fill(0, 32, 0)));
$output = CRT::crc32c($input); $output = CRT::crc32c($input);
$expected = 0x8A9136AA; $expected = 0x8A9136AA;
$this->assertEquals($output, $expected); $this->assertEquals($output, $expected);
} }
public function testCrc32cZeroesIterated() { public function testCrc32cZeroesIterated() {
$output = 0; $output = 0;
for ($i = 0; $i < 32; $i++) { for ($i = 0; $i < 32; $i++) {
$output = CRT::crc32c("\x00", $output); $output = CRT::crc32c("\x00", $output);
} }
$expected = 0x8A9136AA; $expected = 0x8A9136AA;
$this->assertEquals($output, $expected); $this->assertEquals($output, $expected);
} }
public function testCrc32cValuesOneShot() { public function testCrc32cValuesOneShot() {
$input = implode(array_map("chr", range(0, 31))); $input = implode(array_map("chr", range(0, 31)));
$output = CRT::crc32c($input); $output = CRT::crc32c($input);
$expected = 0x46DD794E; $expected = 0x46DD794E;
$this->assertEquals($output, $expected); $this->assertEquals($output, $expected);
} }
public function testCrc32cValuesIterated() { public function testCrc32cValuesIterated() {
$output = 0; $output = 0;
foreach (range(0, 31) as $n) { foreach (range(0, 31) as $n) {
$output = CRT::crc32c(chr($n), $output); $output = CRT::crc32c(chr($n), $output);
} }
$expected = 0x46DD794E; $expected = 0x46DD794E;
$this->assertEquals($output, $expected); $this->assertEquals($output, $expected);
} }
public function testCrc32cLargeBuffer() { public function testCrc32cLargeBuffer() {
$input = implode(array_map("chr", array_fill(0, 1 << 20, 0))); $input = implode(array_map("chr", array_fill(0, 1 << 20, 0)));
$output = CRT::crc32c($input); $output = CRT::crc32c($input);
$expected = 0x14298C12; $expected = 0x14298C12;
$this->assertEquals($output, $expected); $this->assertEquals($output, $expected);
} }
} }

View file

@ -1,46 +1,46 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
use AWS\CRT\Auth\AwsCredentials as AwsCredentials; use AWS\CRT\Auth\AwsCredentials as AwsCredentials;
use AWS\CRT\Auth\StaticCredentialsProvider as StaticCredentialsProvider; use AWS\CRT\Auth\StaticCredentialsProvider as StaticCredentialsProvider;
require_once('common.inc'); require_once('common.inc');
final class CredentialsTest extends CrtTestCase { final class CredentialsTest extends CrtTestCase {
public function testEmptyCredentials() { public function testEmptyCredentials() {
$this->expectException(InvalidArgumentException::class); $this->expectException(InvalidArgumentException::class);
$creds = new AwsCredentials(AwsCredentials::defaults()); $creds = new AwsCredentials(AwsCredentials::defaults());
$this->assertNotNull($creds, "Failed to create default/empty credentials"); $this->assertNotNull($creds, "Failed to create default/empty credentials");
$creds = null; $creds = null;
} }
private function getCredentialsConfig() { private function getCredentialsConfig() {
$options = AwsCredentials::defaults(); $options = AwsCredentials::defaults();
$options['access_key_id'] = 'TESTAWSACCESSKEYID'; $options['access_key_id'] = 'TESTAWSACCESSKEYID';
$options['secret_access_key'] = 'TESTSECRETaccesskeyThatDefinitelyDoesntWork'; $options['secret_access_key'] = 'TESTSECRETaccesskeyThatDefinitelyDoesntWork';
$options['session_token'] = 'ThisIsMyTestSessionTokenIMadeItUpMyself'; $options['session_token'] = 'ThisIsMyTestSessionTokenIMadeItUpMyself';
$options['expiration_timepoint_seconds'] = 42; $options['expiration_timepoint_seconds'] = 42;
return $options; return $options;
} }
public function testCredentialsLifetime() { public function testCredentialsLifetime() {
$options = $this->getCredentialsConfig(); $options = $this->getCredentialsConfig();
$creds = new AwsCredentials($options); $creds = new AwsCredentials($options);
$this->assertNotNull($creds, "Failed to create Credentials with options"); $this->assertNotNull($creds, "Failed to create Credentials with options");
$this->assertEquals($creds->access_key_id, $options['access_key_id']); $this->assertEquals($creds->access_key_id, $options['access_key_id']);
$this->assertEquals($creds->secret_access_key, $options['secret_access_key']); $this->assertEquals($creds->secret_access_key, $options['secret_access_key']);
$this->assertEquals($creds->session_token, $options['session_token']); $this->assertEquals($creds->session_token, $options['session_token']);
$this->assertEquals($creds->expiration_timepoint_seconds, $options['expiration_timepoint_seconds']); $this->assertEquals($creds->expiration_timepoint_seconds, $options['expiration_timepoint_seconds']);
$creds = null; $creds = null;
} }
public function testStaticCredentialsProviderLifetime() { public function testStaticCredentialsProviderLifetime() {
$options = $this->getCredentialsConfig(); $options = $this->getCredentialsConfig();
$provider = new StaticCredentialsProvider($options); $provider = new StaticCredentialsProvider($options);
$this->assertNotNull($provider, "Failed to create StaticCredentialsProvider"); $this->assertNotNull($provider, "Failed to create StaticCredentialsProvider");
$provider = null; $provider = null;
} }
} }

View file

@ -1,21 +1,21 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
use AWS\CRT\CRT; use AWS\CRT\CRT;
final class ErrorTest extends PHPUnit_Framework_TestCase { final class ErrorTest extends PHPUnit_Framework_TestCase {
public function testNoInitialError() { public function testNoInitialError() {
$this->assertEquals(0, CRT::last_error()); $this->assertEquals(0, CRT::last_error());
} }
public function testCanResolveErrorName() { public function testCanResolveErrorName() {
$this->assertEquals("AWS_ERROR_SUCCESS", CRT::error_name(0)); $this->assertEquals("AWS_ERROR_SUCCESS", CRT::error_name(0));
} }
public function testCanResolveErrorStr() { public function testCanResolveErrorStr() {
$this->assertEquals("Success.", CRT::error_str(0)); $this->assertEquals("Success.", CRT::error_str(0));
} }
} }

View file

@ -1,25 +1,25 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
use AWS\CRT\IO\EventLoopGroup as EventLoopGroup; use AWS\CRT\IO\EventLoopGroup as EventLoopGroup;
require_once('common.inc'); require_once('common.inc');
final class EventLoopGroupTest extends CrtTestCase { final class EventLoopGroupTest extends CrtTestCase {
public function testLifetime() { public function testLifetime() {
$elg = new EventLoopGroup(); $elg = new EventLoopGroup();
$this->assertNotNull($elg, "Failed to create default EventLoopGroup"); $this->assertNotNull($elg, "Failed to create default EventLoopGroup");
$elg = null; $elg = null;
} }
public function testConstructionWithOptions() { public function testConstructionWithOptions() {
$options = EventLoopGroup::defaults(); $options = EventLoopGroup::defaults();
$options['num_threads'] = 1; $options['num_threads'] = 1;
$elg = new EventLoopGroup($options); $elg = new EventLoopGroup($options);
$this->assertNotNull($elg, "Failed to create EventLoopGroup with 1 thread"); $this->assertNotNull($elg, "Failed to create EventLoopGroup with 1 thread");
$elg = null; $elg = null;
} }
} }

View file

@ -1,95 +1,95 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
use AWS\CRT\HTTP\Headers; use AWS\CRT\HTTP\Headers;
use AWS\CRT\HTTP\Request; use AWS\CRT\HTTP\Request;
use AWS\CRT\HTTP\Response; use AWS\CRT\HTTP\Response;
require_once('common.inc'); require_once('common.inc');
final class HttpMessageTest extends CrtTestCase { final class HttpMessageTest extends CrtTestCase {
public function testHeaders() { public function testHeaders() {
$headers = new Headers(); $headers = new Headers();
$this->assertSame(0, $headers->count()); $this->assertSame(0, $headers->count());
} }
public function testHeadersMarshalling() { public function testHeadersMarshalling() {
$headers_array = [ $headers_array = [
"host" => "s3.amazonaws.com", "host" => "s3.amazonaws.com",
"test" => "this is a test header value" "test" => "this is a test header value"
]; ];
$headers = new Headers($headers_array); $headers = new Headers($headers_array);
$this->assertSame(2, $headers->count()); $this->assertSame(2, $headers->count());
$this->assertSame($headers_array['host'], $headers->get('host')); $this->assertSame($headers_array['host'], $headers->get('host'));
$this->assertSame($headers_array['test'], $headers->get('test')); $this->assertSame($headers_array['test'], $headers->get('test'));
$buffer = Headers::marshall($headers); $buffer = Headers::marshall($headers);
$headers_copy = Headers::unmarshall($buffer); $headers_copy = Headers::unmarshall($buffer);
$this->assertSame(2, $headers_copy->count()); $this->assertSame(2, $headers_copy->count());
$this->assertSame($headers_array['host'], $headers_copy->get('host')); $this->assertSame($headers_array['host'], $headers_copy->get('host'));
$this->assertSame($headers_array['test'], $headers_copy->get('test')); $this->assertSame($headers_array['test'], $headers_copy->get('test'));
} }
private function assertMessagesMatch($a, $b) { private function assertMessagesMatch($a, $b) {
$this->assertSame($a->method(), $b->method()); $this->assertSame($a->method(), $b->method());
$this->assertSame($a->path(), $b->path()); $this->assertSame($a->path(), $b->path());
$this->assertSame($a->query(), $b->query()); $this->assertSame($a->query(), $b->query());
$this->assertSame($a->headers()->toArray(), $b->headers()->toArray()); $this->assertSame($a->headers()->toArray(), $b->headers()->toArray());
} }
public function testRequestMarshalling() { public function testRequestMarshalling() {
$headers = [ $headers = [
"host" => "s3.amazonaws.com", "host" => "s3.amazonaws.com",
"test" => "this is a test header value" "test" => "this is a test header value"
]; ];
$method = "GET"; $method = "GET";
$path = "/index.php"; $path = "/index.php";
$query = []; $query = [];
$msg = new Request($method, $path, $query, $headers); $msg = new Request($method, $path, $query, $headers);
$msg_buf = Request::marshall($msg); $msg_buf = Request::marshall($msg);
$msg_copy = Request::unmarshall($msg_buf); $msg_copy = Request::unmarshall($msg_buf);
$this->assertMessagesMatch($msg, $msg_copy); $this->assertMessagesMatch($msg, $msg_copy);
} }
public function testRequestMarshallingWithQueryParams() { public function testRequestMarshallingWithQueryParams() {
$headers = [ $headers = [
"host" => "s3.amazonaws.com", "host" => "s3.amazonaws.com",
"test" => "this is a test header value" "test" => "this is a test header value"
]; ];
$method = "GET"; $method = "GET";
$path = "/index.php"; $path = "/index.php";
$query = [ $query = [
'request' => '1', 'request' => '1',
'test' => 'true', 'test' => 'true',
'answer' => '42', 'answer' => '42',
'foo' => 'bar', 'foo' => 'bar',
]; ];
$msg = new Request($method, $path, $query, $headers); $msg = new Request($method, $path, $query, $headers);
$msg_buf = Request::marshall($msg); $msg_buf = Request::marshall($msg);
$msg_copy = Request::unmarshall($msg_buf); $msg_copy = Request::unmarshall($msg_buf);
$this->assertMessagesMatch($msg, $msg_copy); $this->assertMessagesMatch($msg, $msg_copy);
} }
public function testResponseMarshalling() { public function testResponseMarshalling() {
$headers = [ $headers = [
"content-length" => "42", "content-length" => "42",
"test" => "this is a test header value" "test" => "this is a test header value"
]; ];
$method = "GET"; $method = "GET";
$path = "/index.php"; $path = "/index.php";
$query = [ $query = [
'response' => '1' 'response' => '1'
]; ];
$msg = new Response($method, $path, $query, $headers, 200); $msg = new Response($method, $path, $query, $headers, 200);
$msg_buf = Request::marshall($msg); $msg_buf = Request::marshall($msg);
$msg_copy = Request::unmarshall($msg_buf); $msg_copy = Request::unmarshall($msg_buf);
$this->assertMessagesMatch($msg, $msg_copy); $this->assertMessagesMatch($msg, $msg_copy);
} }
} }

View file

@ -1,23 +1,23 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
use AWS\CRT\Log; use AWS\CRT\Log;
require_once('common.inc'); require_once('common.inc');
class LogTest extends CrtTestCase { class LogTest extends CrtTestCase {
public function testLogToStream() { public function testLogToStream() {
$log_stream = fopen("php://memory", "r+"); $log_stream = fopen("php://memory", "r+");
$this->assertNotNull($log_stream); $this->assertNotNull($log_stream);
Log::toStream($log_stream); Log::toStream($log_stream);
Log::setLogLevel(Log::TRACE); Log::setLogLevel(Log::TRACE);
Log::log(Log::TRACE, "THIS IS A TEST"); Log::log(Log::TRACE, "THIS IS A TEST");
$this->assertTrue(rewind($log_stream)); $this->assertTrue(rewind($log_stream));
$log_contents = stream_get_contents($log_stream, -1, 0); $log_contents = stream_get_contents($log_stream, -1, 0);
$this->assertStringEndsWith("THIS IS A TEST", trim($log_contents)); $this->assertStringEndsWith("THIS IS A TEST", trim($log_contents));
Log::stop(); Log::stop();
} }
} }

View file

@ -1,176 +1,176 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
use AWS\CRT\Auth\SignatureType; use AWS\CRT\Auth\SignatureType;
use AWS\CRT\Auth\SigningAlgorithm; use AWS\CRT\Auth\SigningAlgorithm;
use AWS\CRT\Auth\SigningConfigAWS; use AWS\CRT\Auth\SigningConfigAWS;
use AWS\CRT\Auth\Signing; use AWS\CRT\Auth\Signing;
use AWS\CRT\Auth\Signable; use AWS\CRT\Auth\Signable;
use AWS\CRT\Auth\StaticCredentialsProvider; use AWS\CRT\Auth\StaticCredentialsProvider;
use AWS\CRT\HTTP\Request; use AWS\CRT\HTTP\Request;
require_once('common.inc'); require_once('common.inc');
final class SigningTest extends CrtTestCase { final class SigningTest extends CrtTestCase {
public function testConfigAWSLifetime() { public function testConfigAWSLifetime() {
$config = new SigningConfigAWS(); $config = new SigningConfigAWS();
$this->assertNotNull($config, "Failed to create default SigningConfigAWS"); $this->assertNotNull($config, "Failed to create default SigningConfigAWS");
$config = null; $config = null;
} }
public function testConfigAWSConstructionWithOptions() { public function testConfigAWSConstructionWithOptions() {
$options = SigningConfigAWS::defaults(); $options = SigningConfigAWS::defaults();
$options['service'] = 'CRT'; $options['service'] = 'CRT';
$options['region'] = 'CRT'; $options['region'] = 'CRT';
$config = new SigningConfigAWS($options); $config = new SigningConfigAWS($options);
$this->assertNotNull($config, "Failed to create SigningConfigAWS with custom options"); $this->assertNotNull($config, "Failed to create SigningConfigAWS with custom options");
$config = null; $config = null;
} }
public function testSignableFromHttpRequestLifetime() { public function testSignableFromHttpRequestLifetime() {
$request = new Request('GET', '/'); $request = new Request('GET', '/');
$signable = Signable::fromHttpRequest($request); $signable = Signable::fromHttpRequest($request);
$this->assertNotNull($signable, "Failed to create Signable from HTTP::Request"); $this->assertNotNull($signable, "Failed to create Signable from HTTP::Request");
$signable = null; $signable = null;
} }
public function testSignableFromChunkLifetime() { public function testSignableFromChunkLifetime() {
$chunk = "THIS IS A TEST CHUNK IT CONTAINS MULTITUDES"; $chunk = "THIS IS A TEST CHUNK IT CONTAINS MULTITUDES";
$stream = fopen("php://memory", 'r+'); $stream = fopen("php://memory", 'r+');
fputs($stream, $chunk); fputs($stream, $chunk);
rewind($stream); rewind($stream);
$signable = Signable::fromChunk($stream); $signable = Signable::fromChunk($stream);
$this->assertNotNull($signable, "Failed to create Signable from chunk stream"); $this->assertNotNull($signable, "Failed to create Signable from chunk stream");
$signable = null; $signable = null;
} }
public function testSignableFromCanonicalRequestLifetime() { public function testSignableFromCanonicalRequestLifetime() {
$canonical_request = "THIS IS A CANONICAL_REQUEST. IT IS DEEPLY CANONICAL"; $canonical_request = "THIS IS A CANONICAL_REQUEST. IT IS DEEPLY CANONICAL";
$signable = Signable::fromCanonicalRequest($canonical_request); $signable = Signable::fromCanonicalRequest($canonical_request);
$this->assertNotNull($signable, "Failed to create Signable from canonical request"); $this->assertNotNull($signable, "Failed to create Signable from canonical request");
$signable = null; $signable = null;
} }
const SIGV4TEST_ACCESS_KEY_ID = 'AKIDEXAMPLE'; const SIGV4TEST_ACCESS_KEY_ID = 'AKIDEXAMPLE';
const SIGV4TEST_SECRET_ACCESS_KEY = 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY'; const SIGV4TEST_SECRET_ACCESS_KEY = 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY';
const SIGV4TEST_SESSION_TOKEN = null; const SIGV4TEST_SESSION_TOKEN = null;
const SIGV4TEST_SERVICE = 'service'; const SIGV4TEST_SERVICE = 'service';
const SIGV4TEST_REGION = 'us-east-1'; const SIGV4TEST_REGION = 'us-east-1';
private static function SIGV4TEST_DATE() { private static function SIGV4TEST_DATE() {
return mktime(12, 36, 0, 8, 30, 2015); return mktime(12, 36, 0, 8, 30, 2015);
} }
public function testShouldSignHeader() { public function testShouldSignHeader() {
$credentials_provider = new StaticCredentialsProvider([ $credentials_provider = new StaticCredentialsProvider([
'access_key_id' => self::SIGV4TEST_ACCESS_KEY_ID, 'access_key_id' => self::SIGV4TEST_ACCESS_KEY_ID,
'secret_access_key' => self::SIGV4TEST_SECRET_ACCESS_KEY, 'secret_access_key' => self::SIGV4TEST_SECRET_ACCESS_KEY,
'session_token' => self::SIGV4TEST_SESSION_TOKEN, 'session_token' => self::SIGV4TEST_SESSION_TOKEN,
]); ]);
$signing_config = new SigningConfigAWS([ $signing_config = new SigningConfigAWS([
'algorithm' => SigningAlgorithm::SIGv4, 'algorithm' => SigningAlgorithm::SIGv4,
'signature_type' => SignatureType::HTTP_REQUEST_HEADERS, 'signature_type' => SignatureType::HTTP_REQUEST_HEADERS,
'credentials_provider' => $credentials_provider, 'credentials_provider' => $credentials_provider,
'region' => self::SIGV4TEST_REGION, 'region' => self::SIGV4TEST_REGION,
'service' => self::SIGV4TEST_SERVICE, 'service' => self::SIGV4TEST_SERVICE,
'date' => self::SIGV4TEST_DATE(), 'date' => self::SIGV4TEST_DATE(),
'should_sign_header' => function($header) { 'should_sign_header' => function($header) {
return strtolower($header) != 'x-do-not-sign'; return strtolower($header) != 'x-do-not-sign';
} }
]); ]);
$http_request = new Request('GET', '/', [], [ $http_request = new Request('GET', '/', [], [
'Host' => 'example.amazonaws.com', 'Host' => 'example.amazonaws.com',
'X-Do-Not-Sign' => 'DO NOT SIGN THIS']); 'X-Do-Not-Sign' => 'DO NOT SIGN THIS']);
$this->assertNotNull($http_request, "Unable to create HttpRequest for signing"); $this->assertNotNull($http_request, "Unable to create HttpRequest for signing");
$signable = Signable::fromHttpRequest($http_request); $signable = Signable::fromHttpRequest($http_request);
$this->assertNotNull($signable, "Unable to create signable from HttpRequest"); $this->assertNotNull($signable, "Unable to create signable from HttpRequest");
Signing::signRequestAws( Signing::signRequestAws(
$signable, $signing_config, $signable, $signing_config,
function($signing_result, $error_code) use (&$http_request) { function($signing_result, $error_code) use (&$http_request) {
$this->assertEquals(0, $error_code); $this->assertEquals(0, $error_code);
$signing_result->applyToHttpRequest($http_request); $signing_result->applyToHttpRequest($http_request);
} }
); );
// This signature value is computed without the X-Do-Not-Sign header above // This signature value is computed without the X-Do-Not-Sign header above
$headers = $http_request->headers(); $headers = $http_request->headers();
$this->assertEquals( $this->assertEquals(
'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=5fa00fa31553b73ebf1942676e86291e8372ff2a2260956d9b8aae1d763fbf31', 'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=5fa00fa31553b73ebf1942676e86291e8372ff2a2260956d9b8aae1d763fbf31',
$headers->get('Authorization')); $headers->get('Authorization'));
} }
public function testSigv4HeaderSigning() { public function testSigv4HeaderSigning() {
$credentials_provider = new StaticCredentialsProvider([ $credentials_provider = new StaticCredentialsProvider([
'access_key_id' => self::SIGV4TEST_ACCESS_KEY_ID, 'access_key_id' => self::SIGV4TEST_ACCESS_KEY_ID,
'secret_access_key' => self::SIGV4TEST_SECRET_ACCESS_KEY, 'secret_access_key' => self::SIGV4TEST_SECRET_ACCESS_KEY,
'session_token' => self::SIGV4TEST_SESSION_TOKEN, 'session_token' => self::SIGV4TEST_SESSION_TOKEN,
]); ]);
$signing_config = new SigningConfigAWS([ $signing_config = new SigningConfigAWS([
'algorithm' => SigningAlgorithm::SIGv4, 'algorithm' => SigningAlgorithm::SIGv4,
'signature_type' => SignatureType::HTTP_REQUEST_HEADERS, 'signature_type' => SignatureType::HTTP_REQUEST_HEADERS,
'credentials_provider' => $credentials_provider, 'credentials_provider' => $credentials_provider,
'region' => self::SIGV4TEST_REGION, 'region' => self::SIGV4TEST_REGION,
'service' => self::SIGV4TEST_SERVICE, 'service' => self::SIGV4TEST_SERVICE,
'date' => self::SIGV4TEST_DATE(), 'date' => self::SIGV4TEST_DATE(),
]); ]);
$http_request = new Request('GET', '/', [], ['Host' => 'example.amazonaws.com']); $http_request = new Request('GET', '/', [], ['Host' => 'example.amazonaws.com']);
$this->assertNotNull($http_request, "Unable to create HttpRequest for signing"); $this->assertNotNull($http_request, "Unable to create HttpRequest for signing");
$signable = Signable::fromHttpRequest($http_request); $signable = Signable::fromHttpRequest($http_request);
$this->assertNotNull($signable, "Unable to create signable from HttpRequest"); $this->assertNotNull($signable, "Unable to create signable from HttpRequest");
Signing::signRequestAws( Signing::signRequestAws(
$signable, $signing_config, $signable, $signing_config,
function($signing_result, $error_code) use (&$http_request) { function($signing_result, $error_code) use (&$http_request) {
$this->assertEquals(0, $error_code); $this->assertEquals(0, $error_code);
$signing_result->applyToHttpRequest($http_request); $signing_result->applyToHttpRequest($http_request);
} }
); );
$headers = $http_request->headers(); $headers = $http_request->headers();
$this->assertEquals( $this->assertEquals(
'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=5fa00fa31553b73ebf1942676e86291e8372ff2a2260956d9b8aae1d763fbf31', 'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=5fa00fa31553b73ebf1942676e86291e8372ff2a2260956d9b8aae1d763fbf31',
$headers->get('Authorization')); $headers->get('Authorization'));
$this->assertEquals('20150830T123600Z', $headers->get('X-Amz-Date')); $this->assertEquals('20150830T123600Z', $headers->get('X-Amz-Date'));
} }
public function testSigV4aHeaderSigning() { public function testSigV4aHeaderSigning() {
$credentials_provider = new StaticCredentialsProvider([ $credentials_provider = new StaticCredentialsProvider([
'access_key_id' => self::SIGV4TEST_ACCESS_KEY_ID, 'access_key_id' => self::SIGV4TEST_ACCESS_KEY_ID,
'secret_access_key' => self::SIGV4TEST_SECRET_ACCESS_KEY, 'secret_access_key' => self::SIGV4TEST_SECRET_ACCESS_KEY,
'session_token' => self::SIGV4TEST_SESSION_TOKEN, 'session_token' => self::SIGV4TEST_SESSION_TOKEN,
]); ]);
$signing_config = new SigningConfigAWS([ $signing_config = new SigningConfigAWS([
'algorithm' => SigningAlgorithm::SIGv4_ASYMMETRIC, 'algorithm' => SigningAlgorithm::SIGv4_ASYMMETRIC,
'signature_type' => SignatureType::HTTP_REQUEST_HEADERS, 'signature_type' => SignatureType::HTTP_REQUEST_HEADERS,
'credentials_provider' => $credentials_provider, 'credentials_provider' => $credentials_provider,
'region' => self::SIGV4TEST_REGION, 'region' => self::SIGV4TEST_REGION,
'service' => self::SIGV4TEST_SERVICE, 'service' => self::SIGV4TEST_SERVICE,
'date' => self::SIGV4TEST_DATE(), 'date' => self::SIGV4TEST_DATE(),
]); ]);
$http_request = new Request('GET', '/', [], ['Host' => 'example.amazonaws.com']); $http_request = new Request('GET', '/', [], ['Host' => 'example.amazonaws.com']);
$this->assertNotNull($http_request, "Unable to create HttpRequest for signing"); $this->assertNotNull($http_request, "Unable to create HttpRequest for signing");
$signable = Signable::fromHttpRequest($http_request); $signable = Signable::fromHttpRequest($http_request);
$this->assertNotNull($signable, "Unable to create signable from HttpRequest"); $this->assertNotNull($signable, "Unable to create signable from HttpRequest");
Signing::signRequestAws( Signing::signRequestAws(
$signable, $signing_config, $signable, $signing_config,
function($signing_result, $error_code) use (&$http_request) { function($signing_result, $error_code) use (&$http_request) {
$this->assertEquals(0, $error_code); $this->assertEquals(0, $error_code);
$signing_result->applyToHttpRequest($http_request); $signing_result->applyToHttpRequest($http_request);
} }
); );
$headers = $http_request->headers(); $headers = $http_request->headers();
$auth_header_value = $headers->get('Authorization'); $auth_header_value = $headers->get('Authorization');
$this->assertNotNull($auth_header_value); $this->assertNotNull($auth_header_value);
$this->assertStringStartsWith( $this->assertStringStartsWith(
'AWS4-ECDSA-P256-SHA256 Credential=AKIDEXAMPLE/20150830/service/aws4_request, SignedHeaders=host;x-amz-date;x-amz-region-set, Signature=', 'AWS4-ECDSA-P256-SHA256 Credential=AKIDEXAMPLE/20150830/service/aws4_request, SignedHeaders=host;x-amz-date;x-amz-region-set, Signature=',
$auth_header_value); $auth_header_value);
$this->assertEquals('20150830T123600Z', $headers->get('X-Amz-Date')); $this->assertEquals('20150830T123600Z', $headers->get('X-Amz-Date'));
} }
} }

View file

@ -1,34 +1,34 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
use AWS\CRT\IO\InputStream as InputStream; use AWS\CRT\IO\InputStream as InputStream;
require_once('common.inc'); require_once('common.inc');
final class InputStreamTest extends CrtTestCase { final class InputStreamTest extends CrtTestCase {
const MEM_STREAM_CONTENTS = "THIS IS A TEST"; const MEM_STREAM_CONTENTS = "THIS IS A TEST";
private function getMemoryStream() { private function getMemoryStream() {
$stream = fopen("php://memory", 'r+'); $stream = fopen("php://memory", 'r+');
fputs($stream, self::MEM_STREAM_CONTENTS); fputs($stream, self::MEM_STREAM_CONTENTS);
rewind($stream); rewind($stream);
return $stream; return $stream;
} }
public function testMemoryStream() { public function testMemoryStream() {
$mem_stream = $this->getMemoryStream(); $mem_stream = $this->getMemoryStream();
$stream = new InputStream($mem_stream); $stream = new InputStream($mem_stream);
$this->assertNotNull($stream, "Failed to create InputStream from PHP memory stream"); $this->assertNotNull($stream, "Failed to create InputStream from PHP memory stream");
$this->assertEquals(strlen(self::MEM_STREAM_CONTENTS), $stream->length(), "Stream length doesn't match source buffer"); $this->assertEquals(strlen(self::MEM_STREAM_CONTENTS), $stream->length(), "Stream length doesn't match source buffer");
$this->assertEquals(self::MEM_STREAM_CONTENTS, $stream->read(), "Stream doesn't match source buffer"); $this->assertEquals(self::MEM_STREAM_CONTENTS, $stream->read(), "Stream doesn't match source buffer");
$this->assertTrue($stream->eof(), "Stream is not EOF after reading"); $this->assertTrue($stream->eof(), "Stream is not EOF after reading");
$this->assertEquals(0, $stream->seek(0, InputStream::SEEK_BEGIN), "Unable to rewind stream"); $this->assertEquals(0, $stream->seek(0, InputStream::SEEK_BEGIN), "Unable to rewind stream");
$this->assertFalse($stream->eof(), "Stream is EOF after rewinding"); $this->assertFalse($stream->eof(), "Stream is EOF after rewinding");
$this->assertEquals(0, $stream->seek(0, InputStream::SEEK_END), "Unable to seek to end of stream"); $this->assertEquals(0, $stream->seek(0, InputStream::SEEK_END), "Unable to seek to end of stream");
$this->assertTrue($stream->eof(), "Stream is not EOF after seeking to end"); $this->assertTrue($stream->eof(), "Stream is not EOF after seeking to end");
$stream = null; $stream = null;
} }
} }

View file

@ -1,34 +1,34 @@
<?php <?php
/** /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0. * SPDX-License-Identifier: Apache-2.0.
*/ */
use AWS\CRT\CRT as CRT; use AWS\CRT\CRT as CRT;
ini_set("memory_limit", "512M"); ini_set("memory_limit", "512M");
abstract class CrtTestCase extends PHPUnit_Framework_TestCase { abstract class CrtTestCase extends PHPUnit_Framework_TestCase {
private static $crt = null; private static $crt = null;
public static function setUpBeforeClass() { public static function setUpBeforeClass() {
self::$crt = new CRT(); self::$crt = new CRT();
} }
public static function tearDownAfterClass() { public static function tearDownAfterClass() {
self::$crt = null; self::$crt = null;
} }
// Ensure that after every test there are no errors in the CRT itself // Ensure that after every test there are no errors in the CRT itself
protected function assertPostConditions() { protected function assertPostConditions() {
if (CRT::last_error()) { if (CRT::last_error()) {
$this->fail("Test left an error on the stack: " . CRT::error_name(CRT::last_error())); $this->fail("Test left an error on the stack: " . CRT::error_name(CRT::last_error()));
} }
} }
// Shim missing calls in older versions of PHPUnit // Shim missing calls in older versions of PHPUnit
public function __call($name, $arguments) { public function __call($name, $arguments) {
// shim expectException -> setExpectedException for PHPUnit 4.8.x // shim expectException -> setExpectedException for PHPUnit 4.8.x
if ($name == 'expectException') { if ($name == 'expectException') {
$this->setExpectedException($arguments[0]); $this->setExpectedException($arguments[0]);
} }
} }
} }

View file

@ -24,7 +24,7 @@
"ext-pcre": "*", "ext-pcre": "*",
"ext-json": "*", "ext-json": "*",
"ext-simplexml": "*", "ext-simplexml": "*",
"aws/aws-crt-php": "^1.0.2" "aws/aws-crt-php": "^1.0.4"
}, },
"require-dev": { "require-dev": {
"composer/composer" : "^1.10.22", "composer/composer" : "^1.10.22",
@ -70,3 +70,4 @@
} }
} }
} }

View file

@ -0,0 +1,21 @@
<?php
namespace Aws\ARCZonalShift;
use Aws\AwsClient;
/**
* This client is used to interact with the **AWS ARC - Zonal Shift** service.
* @method \Aws\Result cancelZonalShift(array $args = [])
* @method \GuzzleHttp\Promise\Promise cancelZonalShiftAsync(array $args = [])
* @method \Aws\Result getManagedResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise getManagedResourceAsync(array $args = [])
* @method \Aws\Result listManagedResources(array $args = [])
* @method \GuzzleHttp\Promise\Promise listManagedResourcesAsync(array $args = [])
* @method \Aws\Result listZonalShifts(array $args = [])
* @method \GuzzleHttp\Promise\Promise listZonalShiftsAsync(array $args = [])
* @method \Aws\Result startZonalShift(array $args = [])
* @method \GuzzleHttp\Promise\Promise startZonalShiftAsync(array $args = [])
* @method \Aws\Result updateZonalShift(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateZonalShiftAsync(array $args = [])
*/
class ARCZonalShiftClient extends AwsClient {}

View file

@ -0,0 +1,9 @@
<?php
namespace Aws\ARCZonalShift\Exception;
use Aws\Exception\AwsException;
/**
* Represents an error interacting with the **AWS ARC - Zonal Shift** service.
*/
class ARCZonalShiftException extends AwsException {}

View file

@ -7,10 +7,18 @@ use Aws\AwsClient;
* This client is used to interact with the **AWS Account** service. * This client is used to interact with the **AWS Account** service.
* @method \Aws\Result deleteAlternateContact(array $args = []) * @method \Aws\Result deleteAlternateContact(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAlternateContactAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise deleteAlternateContactAsync(array $args = [])
* @method \Aws\Result disableRegion(array $args = [])
* @method \GuzzleHttp\Promise\Promise disableRegionAsync(array $args = [])
* @method \Aws\Result enableRegion(array $args = [])
* @method \GuzzleHttp\Promise\Promise enableRegionAsync(array $args = [])
* @method \Aws\Result getAlternateContact(array $args = []) * @method \Aws\Result getAlternateContact(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAlternateContactAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise getAlternateContactAsync(array $args = [])
* @method \Aws\Result getContactInformation(array $args = []) * @method \Aws\Result getContactInformation(array $args = [])
* @method \GuzzleHttp\Promise\Promise getContactInformationAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise getContactInformationAsync(array $args = [])
* @method \Aws\Result getRegionOptStatus(array $args = [])
* @method \GuzzleHttp\Promise\Promise getRegionOptStatusAsync(array $args = [])
* @method \Aws\Result listRegions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listRegionsAsync(array $args = [])
* @method \Aws\Result putAlternateContact(array $args = []) * @method \Aws\Result putAlternateContact(array $args = [])
* @method \GuzzleHttp\Promise\Promise putAlternateContactAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise putAlternateContactAsync(array $args = [])
* @method \Aws\Result putContactInformation(array $args = []) * @method \Aws\Result putContactInformation(array $args = [])

View file

@ -12,6 +12,9 @@ abstract class AbstractModel implements \ArrayAccess
/** @var ShapeMap */ /** @var ShapeMap */
protected $shapeMap; protected $shapeMap;
/** @var array */
protected $contextParam;
/** /**
* @param array $definition Service description * @param array $definition Service description
* @param ShapeMap $shapeMap Shapemap used for creating shapes * @param ShapeMap $shapeMap Shapemap used for creating shapes
@ -20,6 +23,9 @@ abstract class AbstractModel implements \ArrayAccess
{ {
$this->definition = $definition; $this->definition = $definition;
$this->shapeMap = $shapeMap; $this->shapeMap = $shapeMap;
if (isset($definition['contextParam'])) {
$this->contextParam = $definition['contextParam'];
}
} }
public function toArray() public function toArray()

View file

@ -97,7 +97,17 @@ class DocModel
} }
if (isset($d['append'])) { if (isset($d['append'])) {
$result .= $d['append']; if (!isset($d['excludeAppend'])
|| !in_array($parentName, $d['excludeAppend'])
) {
$result .= $d['append'];
}
}
if (isset($d['appendOnly'])
&& in_array($parentName, $d['appendOnly']['shapes'])
) {
$result .= $d['appendOnly']['message'];
} }
return $this->clean($result); return $this->clean($result);

View file

@ -9,6 +9,8 @@ class Operation extends AbstractModel
private $input; private $input;
private $output; private $output;
private $errors; private $errors;
private $staticContextParams = [];
private $contextParams;
public function __construct(array $definition, ShapeMap $shapeMap) public function __construct(array $definition, ShapeMap $shapeMap)
{ {
@ -22,7 +24,12 @@ class Operation extends AbstractModel
$definition['http']['requestUri'] = '/'; $definition['http']['requestUri'] = '/';
} }
if (isset($definition['staticContextParams'])) {
$this->staticContextParams = $definition['staticContextParams'];
}
parent::__construct($definition, $shapeMap); parent::__construct($definition, $shapeMap);
$this->contextParams = $this->setContextParams();
} }
/** /**
@ -94,4 +101,42 @@ class Operation extends AbstractModel
return $this->errors; return $this->errors;
} }
/**
* Gets static modeled static values used for
* endpoint resolution.
*
* @return array
*/
public function getStaticContextParams()
{
return $this->staticContextParams;
}
/**
* Gets definition of modeled dynamic values used
* for endpoint resolution
*
* @return array
*/
public function getContextParams()
{
return $this->contextParams;
}
private function setContextParams()
{
$members = $this->getInput()->getMembers();
$contextParams = [];
foreach($members as $name => $shape) {
if (!empty($contextParam = $shape->getContextParam())) {
$contextParams[$contextParam['name']] = [
'shape' => $name,
'type' => $shape->getType()
];
}
}
return $contextParams;
}
} }

View file

@ -3,6 +3,8 @@ namespace Aws\Api\Serializer;
use Aws\Api\Service; use Aws\Api\Service;
use Aws\CommandInterface; use Aws\CommandInterface;
use Aws\EndpointV2\EndpointProviderV2;
use Aws\EndpointV2\EndpointV2SerializerTrait;
use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Request;
use Psr\Http\Message\RequestInterface; use Psr\Http\Message\RequestInterface;
@ -12,6 +14,8 @@ use Psr\Http\Message\RequestInterface;
*/ */
class JsonRpcSerializer class JsonRpcSerializer
{ {
use EndpointV2SerializerTrait;
/** @var JsonBody */ /** @var JsonBody */
private $jsonFormatter; private $jsonFormatter;
@ -44,25 +48,44 @@ class JsonRpcSerializer
* When invoked with an AWS command, returns a serialization array * When invoked with an AWS command, returns a serialization array
* containing "method", "uri", "headers", and "body" key value pairs. * containing "method", "uri", "headers", and "body" key value pairs.
* *
* @param CommandInterface $command * @param CommandInterface $command Command to serialize into a request.
* @param $endpointProvider Provider used for dynamic endpoint resolution.
* @param $clientArgs Client arguments used for dynamic endpoint resolution.
* *
* @return RequestInterface * @return RequestInterface
*/ */
public function __invoke(CommandInterface $command) public function __invoke(
CommandInterface $command,
$endpointProvider = null,
$clientArgs = null
)
{ {
$name = $command->getName(); $operationName = $command->getName();
$operation = $this->api->getOperation($name); $operation = $this->api->getOperation($operationName);
$commandArgs = $command->toArray();
$headers = [
'X-Amz-Target' => $this->api->getMetadata('targetPrefix') . '.' . $operationName,
'Content-Type' => $this->contentType
];
if ($endpointProvider instanceof EndpointProviderV2) {
$this->setRequestOptions(
$endpointProvider,
$command,
$operation,
$commandArgs,
$clientArgs,
$headers
);
}
return new Request( return new Request(
$operation['http']['method'], $operation['http']['method'],
$this->endpoint, $this->endpoint,
[ $headers,
'X-Amz-Target' => $this->api->getMetadata('targetPrefix') . '.' . $name,
'Content-Type' => $this->contentType
],
$this->jsonFormatter->build( $this->jsonFormatter->build(
$operation->getInput(), $operation->getInput(),
$command->toArray() $commandArgs
) )
); );
} }

View file

@ -3,6 +3,8 @@ namespace Aws\Api\Serializer;
use Aws\Api\Service; use Aws\Api\Service;
use Aws\CommandInterface; use Aws\CommandInterface;
use Aws\EndpointV2\EndpointProviderV2;
use Aws\EndpointV2\EndpointV2SerializerTrait;
use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Request;
use Psr\Http\Message\RequestInterface; use Psr\Http\Message\RequestInterface;
@ -12,6 +14,8 @@ use Psr\Http\Message\RequestInterface;
*/ */
class QuerySerializer class QuerySerializer
{ {
use EndpointV2SerializerTrait;
private $endpoint; private $endpoint;
private $api; private $api;
private $paramBuilder; private $paramBuilder;
@ -30,39 +34,54 @@ class QuerySerializer
* When invoked with an AWS command, returns a serialization array * When invoked with an AWS command, returns a serialization array
* containing "method", "uri", "headers", and "body" key value pairs. * containing "method", "uri", "headers", and "body" key value pairs.
* *
* @param CommandInterface $command * @param CommandInterface $command Command to serialize into a request.
* @param $endpointProvider Provider used for dynamic endpoint resolution.
* @param $clientArgs Client arguments used for dynamic endpoint resolution.
* *
* @return RequestInterface * @return RequestInterface
*/ */
public function __invoke(CommandInterface $command) public function __invoke(
CommandInterface $command,
$endpointProvider = null,
$clientArgs = null
)
{ {
$operation = $this->api->getOperation($command->getName()); $operation = $this->api->getOperation($command->getName());
$body = [ $body = [
'Action' => $command->getName(), 'Action' => $command->getName(),
'Version' => $this->api->getMetadata('apiVersion') 'Version' => $this->api->getMetadata('apiVersion')
]; ];
$commandArgs = $command->toArray();
$params = $command->toArray();
// Only build up the parameters when there are parameters to build // Only build up the parameters when there are parameters to build
if ($params) { if ($commandArgs) {
$body += call_user_func( $body += call_user_func(
$this->paramBuilder, $this->paramBuilder,
$operation->getInput(), $operation->getInput(),
$params $commandArgs
); );
} }
$body = http_build_query($body, '', '&', PHP_QUERY_RFC3986); $body = http_build_query($body, '', '&', PHP_QUERY_RFC3986);
$headers = [
'Content-Length' => strlen($body),
'Content-Type' => 'application/x-www-form-urlencoded'
];
if ($endpointProvider instanceof EndpointProviderV2) {
$this->setRequestOptions(
$endpointProvider,
$command,
$operation,
$commandArgs,
$clientArgs,
$headers
);
}
return new Request( return new Request(
'POST', 'POST',
$this->endpoint, $this->endpoint,
[ $headers,
'Content-Length' => strlen($body),
'Content-Type' => 'application/x-www-form-urlencoded'
],
$body $body
); );
} }

View file

@ -8,7 +8,10 @@ use Aws\Api\Shape;
use Aws\Api\StructureShape; use Aws\Api\StructureShape;
use Aws\Api\TimestampShape; use Aws\Api\TimestampShape;
use Aws\CommandInterface; use Aws\CommandInterface;
use Aws\EndpointV2\EndpointProviderV2;
use Aws\EndpointV2\EndpointV2SerializerTrait;
use GuzzleHttp\Psr7; use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Uri; use GuzzleHttp\Psr7\Uri;
use GuzzleHttp\Psr7\UriResolver; use GuzzleHttp\Psr7\UriResolver;
use Psr\Http\Message\RequestInterface; use Psr\Http\Message\RequestInterface;
@ -19,10 +22,12 @@ use Psr\Http\Message\RequestInterface;
*/ */
abstract class RestSerializer abstract class RestSerializer
{ {
use EndpointV2SerializerTrait;
/** @var Service */ /** @var Service */
private $api; private $api;
/** @var Psr7\Uri */ /** @var Uri */
private $endpoint; private $endpoint;
/** /**
@ -36,21 +41,40 @@ abstract class RestSerializer
} }
/** /**
* @param CommandInterface $command Command to serialized * @param CommandInterface $command Command to serialize into a request.
* @param $endpointProvider Provider used for dynamic endpoint resolution.
* @param $clientArgs Client arguments used for dynamic endpoint resolution.
* *
* @return RequestInterface * @return RequestInterface
*/ */
public function __invoke(CommandInterface $command) public function __invoke(
CommandInterface $command,
$endpointProvider = null,
$clientArgs = null
)
{ {
$operation = $this->api->getOperation($command->getName()); $operation = $this->api->getOperation($command->getName());
$args = $command->toArray(); $commandArgs = $command->toArray();
$opts = $this->serialize($operation, $args); $opts = $this->serialize($operation, $commandArgs);
$uri = $this->buildEndpoint($operation, $args, $opts); $headers = isset($opts['headers']) ? $opts['headers'] : [];
return new Psr7\Request( if ($endpointProvider instanceof EndpointProviderV2) {
$this->setRequestOptions(
$endpointProvider,
$command,
$operation,
$commandArgs,
$clientArgs,
$headers
);
$this->endpoint = new Uri($this->endpoint);
}
$uri = $this->buildEndpoint($operation, $commandArgs, $opts);
return new Request(
$operation['http']['method'], $operation['http']['method'],
$uri, $uri,
isset($opts['headers']) ? $opts['headers'] : [], $headers,
isset($opts['body']) ? $opts['body'] : null isset($opts['body']) ? $opts['body'] : null
); );
} }
@ -181,48 +205,57 @@ abstract class RestSerializer
private function buildEndpoint(Operation $operation, array $args, array $opts) private function buildEndpoint(Operation $operation, array $args, array $opts)
{ {
$varspecs = []; // Create an associative array of variable definitions used in expansions
$varDefinitions = $this->getVarDefinitions($operation, $args);
// Create an associative array of varspecs used in expansions
foreach ($operation->getInput()->getMembers() as $name => $member) {
if ($member['location'] == 'uri') {
$varspecs[$member['locationName'] ?: $name] =
isset($args[$name])
? $args[$name]
: null;
}
}
$relative = preg_replace_callback( $relative = preg_replace_callback(
'/\{([^\}]+)\}/', '/\{([^\}]+)\}/',
function (array $matches) use ($varspecs) { function (array $matches) use ($varDefinitions) {
$isGreedy = substr($matches[1], -1, 1) == '+'; $isGreedy = substr($matches[1], -1, 1) == '+';
$k = $isGreedy ? substr($matches[1], 0, -1) : $matches[1]; $k = $isGreedy ? substr($matches[1], 0, -1) : $matches[1];
if (!isset($varspecs[$k])) { if (!isset($varDefinitions[$k])) {
return ''; return '';
} }
if ($isGreedy) { if ($isGreedy) {
return str_replace('%2F', '/', rawurlencode($varspecs[$k])); return str_replace('%2F', '/', rawurlencode($varDefinitions[$k]));
} }
return rawurlencode($varspecs[$k]); return rawurlencode($varDefinitions[$k]);
}, },
$operation['http']['requestUri'] $operation['http']['requestUri']
); );
// Add the query string variables or appending to one if needed. // Add the query string variables or appending to one if needed.
if (!empty($opts['query'])) { if (!empty($opts['query'])) {
$append = Psr7\Query::build($opts['query']); $relative = $this->appendQuery($opts['query'], $relative);
$relative .= strpos($relative, '?') ? "&{$append}" : "?$append";
} }
// If endpoint has path, remove leading '/' to preserve URI resolution.
$path = $this->endpoint->getPath(); $path = $this->endpoint->getPath();
//Accounts for trailing '/' in path when custom endpoint
//is provided to endpointProviderV2
if ($this->api->isModifiedModel()
&& $this->api->getServiceName() === 's3'
) {
if (substr($path, -1) === '/' && $relative[0] === '/') {
$path = rtrim($path, '/');
}
$relative = $path . $relative;
}
// If endpoint has path, remove leading '/' to preserve URI resolution.
if ($path && $relative[0] === '/') { if ($path && $relative[0] === '/') {
$relative = substr($relative, 1); $relative = substr($relative, 1);
} }
//Append path to endpoint when leading '//...' present
// as uri cannot be properly resolved
if ($this->api->isModifiedModel()
&& strpos($relative, '//') === 0
) {
return new Uri($this->endpoint . $relative);
}
// Expand path place holders using Amazon's slightly different URI // Expand path place holders using Amazon's slightly different URI
// template syntax. // template syntax.
return UriResolver::resolve($this->endpoint, new Uri($relative)); return UriResolver::resolve($this->endpoint, new Uri($relative));
@ -250,4 +283,25 @@ abstract class RestSerializer
} }
return false; return false;
} }
private function appendQuery($query, $endpoint)
{
$append = Psr7\Query::build($query);
return $endpoint .= strpos($endpoint, '?') !== false ? "&{$append}" : "?{$append}";
}
private function getVarDefinitions($command, $args)
{
$varDefinitions = [];
foreach ($command->getInput()->getMembers() as $name => $member) {
if ($member['location'] == 'uri') {
$varDefinitions[$member['locationName'] ?: $name] =
isset($args[$name])
? $args[$name]
: null;
}
}
return $varDefinitions;
}
} }

View file

@ -19,6 +19,9 @@ class Service extends AbstractModel
/** @var string */ /** @var string */
private $apiVersion; private $apiVersion;
/** @var array */
private $clientContextParams = [];
/** @var Operation[] */ /** @var Operation[] */
private $operations = []; private $operations = [];
@ -28,6 +31,9 @@ class Service extends AbstractModel
/** @var array */ /** @var array */
private $waiters = null; private $waiters = null;
/** @var boolean */
private $modifiedModel = false;
/** /**
* @param array $definition * @param array $definition
* @param callable $provider * @param callable $provider
@ -39,7 +45,8 @@ class Service extends AbstractModel
static $defaults = [ static $defaults = [
'operations' => [], 'operations' => [],
'shapes' => [], 'shapes' => [],
'metadata' => [] 'metadata' => [],
'clientContextParams' => []
], $defaultMeta = [ ], $defaultMeta = [
'apiVersion' => null, 'apiVersion' => null,
'serviceFullName' => null, 'serviceFullName' => null,
@ -62,8 +69,10 @@ class Service extends AbstractModel
} else { } else {
$this->serviceName = $this->getEndpointPrefix(); $this->serviceName = $this->getEndpointPrefix();
} }
$this->apiVersion = $this->getApiVersion(); $this->apiVersion = $this->getApiVersion();
if (isset($definition['clientContextParams'])) {
$this->clientContextParams = $definition['clientContextParams'];
}
} }
/** /**
@ -279,6 +288,11 @@ class Service extends AbstractModel
$this->definition['operations'][$name], $this->definition['operations'][$name],
$this->shapeMap $this->shapeMap
); );
} else if ($this->modifiedModel) {
$this->operations[$name] = new Operation(
$this->definition['operations'][$name],
$this->shapeMap
);
} }
return $this->operations[$name]; return $this->operations[$name];
@ -465,4 +479,61 @@ class Service extends AbstractModel
{ {
return $this->shapeMap; return $this->shapeMap;
} }
/**
* Get all the context params of the description.
*
* @return array
*/
public function getClientContextParams()
{
return $this->clientContextParams;
}
/**
* Get the service's api provider.
*
* @return callable
*/
public function getProvider()
{
return $this->apiProvider;
}
/**
* Get the service's definition.
*
* @return callable
*/
public function getDefinition()
{
return $this->definition;
}
/**
* Sets the service's api definition.
* Intended for internal use only.
*
* @return void
*
* @internal
*/
public function setDefinition($definition)
{
$this->definition = $definition;
$this->modifiedModel = true;
}
/**
* Denotes whether or not a service's definition has
* been modified. Intended for internal use only.
*
* @return bool
*
* @internal
*/
public function isModifiedModel()
{
return $this->modifiedModel;
}
} }

View file

@ -66,4 +66,12 @@ class Shape extends AbstractModel
{ {
return $this->definition['name']; return $this->definition['name'];
} }
/**
* Get a context param definition.
*/
public function getContextParam()
{
return $this->contextParam;
}
} }

View file

@ -27,6 +27,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise getAssociatedResourceAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise getAssociatedResourceAsync(array $args = [])
* @method \Aws\Result getAttributeGroup(array $args = []) * @method \Aws\Result getAttributeGroup(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAttributeGroupAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise getAttributeGroupAsync(array $args = [])
* @method \Aws\Result getConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise getConfigurationAsync(array $args = [])
* @method \Aws\Result listApplications(array $args = []) * @method \Aws\Result listApplications(array $args = [])
* @method \GuzzleHttp\Promise\Promise listApplicationsAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise listApplicationsAsync(array $args = [])
* @method \Aws\Result listAssociatedAttributeGroups(array $args = []) * @method \Aws\Result listAssociatedAttributeGroups(array $args = [])
@ -39,6 +41,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise listAttributeGroupsForApplicationAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise listAttributeGroupsForApplicationAsync(array $args = [])
* @method \Aws\Result listTagsForResource(array $args = []) * @method \Aws\Result listTagsForResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
* @method \Aws\Result putConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise putConfigurationAsync(array $args = [])
* @method \Aws\Result syncResource(array $args = []) * @method \Aws\Result syncResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise syncResourceAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise syncResourceAsync(array $args = [])
* @method \Aws\Result tagResource(array $args = []) * @method \Aws\Result tagResource(array $args = [])

View file

@ -41,6 +41,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise deleteTypeAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise deleteTypeAsync(array $args = [])
* @method \Aws\Result disassociateApi(array $args = []) * @method \Aws\Result disassociateApi(array $args = [])
* @method \GuzzleHttp\Promise\Promise disassociateApiAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise disassociateApiAsync(array $args = [])
* @method \Aws\Result evaluateCode(array $args = [])
* @method \GuzzleHttp\Promise\Promise evaluateCodeAsync(array $args = [])
* @method \Aws\Result evaluateMappingTemplate(array $args = []) * @method \Aws\Result evaluateMappingTemplate(array $args = [])
* @method \GuzzleHttp\Promise\Promise evaluateMappingTemplateAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise evaluateMappingTemplateAsync(array $args = [])
* @method \Aws\Result flushApiCache(array $args = []) * @method \Aws\Result flushApiCache(array $args = [])

View file

@ -47,6 +47,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = [])
* @method \Aws\Result updateConnectorProfile(array $args = []) * @method \Aws\Result updateConnectorProfile(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateConnectorProfileAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise updateConnectorProfileAsync(array $args = [])
* @method \Aws\Result updateConnectorRegistration(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateConnectorRegistrationAsync(array $args = [])
* @method \Aws\Result updateFlow(array $args = []) * @method \Aws\Result updateFlow(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateFlowAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise updateFlowAsync(array $args = [])
*/ */

View file

@ -15,24 +15,40 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise createDataCatalogAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise createDataCatalogAsync(array $args = [])
* @method \Aws\Result createNamedQuery(array $args = []) * @method \Aws\Result createNamedQuery(array $args = [])
* @method \GuzzleHttp\Promise\Promise createNamedQueryAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise createNamedQueryAsync(array $args = [])
* @method \Aws\Result createNotebook(array $args = [])
* @method \GuzzleHttp\Promise\Promise createNotebookAsync(array $args = [])
* @method \Aws\Result createPreparedStatement(array $args = []) * @method \Aws\Result createPreparedStatement(array $args = [])
* @method \GuzzleHttp\Promise\Promise createPreparedStatementAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise createPreparedStatementAsync(array $args = [])
* @method \Aws\Result createPresignedNotebookUrl(array $args = [])
* @method \GuzzleHttp\Promise\Promise createPresignedNotebookUrlAsync(array $args = [])
* @method \Aws\Result createWorkGroup(array $args = []) * @method \Aws\Result createWorkGroup(array $args = [])
* @method \GuzzleHttp\Promise\Promise createWorkGroupAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise createWorkGroupAsync(array $args = [])
* @method \Aws\Result deleteDataCatalog(array $args = []) * @method \Aws\Result deleteDataCatalog(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteDataCatalogAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise deleteDataCatalogAsync(array $args = [])
* @method \Aws\Result deleteNamedQuery(array $args = []) * @method \Aws\Result deleteNamedQuery(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteNamedQueryAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise deleteNamedQueryAsync(array $args = [])
* @method \Aws\Result deleteNotebook(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteNotebookAsync(array $args = [])
* @method \Aws\Result deletePreparedStatement(array $args = []) * @method \Aws\Result deletePreparedStatement(array $args = [])
* @method \GuzzleHttp\Promise\Promise deletePreparedStatementAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise deletePreparedStatementAsync(array $args = [])
* @method \Aws\Result deleteWorkGroup(array $args = []) * @method \Aws\Result deleteWorkGroup(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteWorkGroupAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise deleteWorkGroupAsync(array $args = [])
* @method \Aws\Result exportNotebook(array $args = [])
* @method \GuzzleHttp\Promise\Promise exportNotebookAsync(array $args = [])
* @method \Aws\Result getCalculationExecution(array $args = [])
* @method \GuzzleHttp\Promise\Promise getCalculationExecutionAsync(array $args = [])
* @method \Aws\Result getCalculationExecutionCode(array $args = [])
* @method \GuzzleHttp\Promise\Promise getCalculationExecutionCodeAsync(array $args = [])
* @method \Aws\Result getCalculationExecutionStatus(array $args = [])
* @method \GuzzleHttp\Promise\Promise getCalculationExecutionStatusAsync(array $args = [])
* @method \Aws\Result getDataCatalog(array $args = []) * @method \Aws\Result getDataCatalog(array $args = [])
* @method \GuzzleHttp\Promise\Promise getDataCatalogAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise getDataCatalogAsync(array $args = [])
* @method \Aws\Result getDatabase(array $args = []) * @method \Aws\Result getDatabase(array $args = [])
* @method \GuzzleHttp\Promise\Promise getDatabaseAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise getDatabaseAsync(array $args = [])
* @method \Aws\Result getNamedQuery(array $args = []) * @method \Aws\Result getNamedQuery(array $args = [])
* @method \GuzzleHttp\Promise\Promise getNamedQueryAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise getNamedQueryAsync(array $args = [])
* @method \Aws\Result getNotebookMetadata(array $args = [])
* @method \GuzzleHttp\Promise\Promise getNotebookMetadataAsync(array $args = [])
* @method \Aws\Result getPreparedStatement(array $args = []) * @method \Aws\Result getPreparedStatement(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPreparedStatementAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise getPreparedStatementAsync(array $args = [])
* @method \Aws\Result getQueryExecution(array $args = []) * @method \Aws\Result getQueryExecution(array $args = [])
@ -41,40 +57,70 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise getQueryResultsAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise getQueryResultsAsync(array $args = [])
* @method \Aws\Result getQueryRuntimeStatistics(array $args = []) * @method \Aws\Result getQueryRuntimeStatistics(array $args = [])
* @method \GuzzleHttp\Promise\Promise getQueryRuntimeStatisticsAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise getQueryRuntimeStatisticsAsync(array $args = [])
* @method \Aws\Result getSession(array $args = [])
* @method \GuzzleHttp\Promise\Promise getSessionAsync(array $args = [])
* @method \Aws\Result getSessionStatus(array $args = [])
* @method \GuzzleHttp\Promise\Promise getSessionStatusAsync(array $args = [])
* @method \Aws\Result getTableMetadata(array $args = []) * @method \Aws\Result getTableMetadata(array $args = [])
* @method \GuzzleHttp\Promise\Promise getTableMetadataAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise getTableMetadataAsync(array $args = [])
* @method \Aws\Result getWorkGroup(array $args = []) * @method \Aws\Result getWorkGroup(array $args = [])
* @method \GuzzleHttp\Promise\Promise getWorkGroupAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise getWorkGroupAsync(array $args = [])
* @method \Aws\Result importNotebook(array $args = [])
* @method \GuzzleHttp\Promise\Promise importNotebookAsync(array $args = [])
* @method \Aws\Result listApplicationDPUSizes(array $args = [])
* @method \GuzzleHttp\Promise\Promise listApplicationDPUSizesAsync(array $args = [])
* @method \Aws\Result listCalculationExecutions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listCalculationExecutionsAsync(array $args = [])
* @method \Aws\Result listDataCatalogs(array $args = []) * @method \Aws\Result listDataCatalogs(array $args = [])
* @method \GuzzleHttp\Promise\Promise listDataCatalogsAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise listDataCatalogsAsync(array $args = [])
* @method \Aws\Result listDatabases(array $args = []) * @method \Aws\Result listDatabases(array $args = [])
* @method \GuzzleHttp\Promise\Promise listDatabasesAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise listDatabasesAsync(array $args = [])
* @method \Aws\Result listEngineVersions(array $args = []) * @method \Aws\Result listEngineVersions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listEngineVersionsAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise listEngineVersionsAsync(array $args = [])
* @method \Aws\Result listExecutors(array $args = [])
* @method \GuzzleHttp\Promise\Promise listExecutorsAsync(array $args = [])
* @method \Aws\Result listNamedQueries(array $args = []) * @method \Aws\Result listNamedQueries(array $args = [])
* @method \GuzzleHttp\Promise\Promise listNamedQueriesAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise listNamedQueriesAsync(array $args = [])
* @method \Aws\Result listNotebookMetadata(array $args = [])
* @method \GuzzleHttp\Promise\Promise listNotebookMetadataAsync(array $args = [])
* @method \Aws\Result listNotebookSessions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listNotebookSessionsAsync(array $args = [])
* @method \Aws\Result listPreparedStatements(array $args = []) * @method \Aws\Result listPreparedStatements(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPreparedStatementsAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise listPreparedStatementsAsync(array $args = [])
* @method \Aws\Result listQueryExecutions(array $args = []) * @method \Aws\Result listQueryExecutions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listQueryExecutionsAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise listQueryExecutionsAsync(array $args = [])
* @method \Aws\Result listSessions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listSessionsAsync(array $args = [])
* @method \Aws\Result listTableMetadata(array $args = []) * @method \Aws\Result listTableMetadata(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTableMetadataAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise listTableMetadataAsync(array $args = [])
* @method \Aws\Result listTagsForResource(array $args = []) * @method \Aws\Result listTagsForResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
* @method \Aws\Result listWorkGroups(array $args = []) * @method \Aws\Result listWorkGroups(array $args = [])
* @method \GuzzleHttp\Promise\Promise listWorkGroupsAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise listWorkGroupsAsync(array $args = [])
* @method \Aws\Result startCalculationExecution(array $args = [])
* @method \GuzzleHttp\Promise\Promise startCalculationExecutionAsync(array $args = [])
* @method \Aws\Result startQueryExecution(array $args = []) * @method \Aws\Result startQueryExecution(array $args = [])
* @method \GuzzleHttp\Promise\Promise startQueryExecutionAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise startQueryExecutionAsync(array $args = [])
* @method \Aws\Result startSession(array $args = [])
* @method \GuzzleHttp\Promise\Promise startSessionAsync(array $args = [])
* @method \Aws\Result stopCalculationExecution(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopCalculationExecutionAsync(array $args = [])
* @method \Aws\Result stopQueryExecution(array $args = []) * @method \Aws\Result stopQueryExecution(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopQueryExecutionAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise stopQueryExecutionAsync(array $args = [])
* @method \Aws\Result tagResource(array $args = []) * @method \Aws\Result tagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = [])
* @method \Aws\Result terminateSession(array $args = [])
* @method \GuzzleHttp\Promise\Promise terminateSessionAsync(array $args = [])
* @method \Aws\Result untagResource(array $args = []) * @method \Aws\Result untagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = [])
* @method \Aws\Result updateDataCatalog(array $args = []) * @method \Aws\Result updateDataCatalog(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateDataCatalogAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise updateDataCatalogAsync(array $args = [])
* @method \Aws\Result updateNamedQuery(array $args = []) * @method \Aws\Result updateNamedQuery(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateNamedQueryAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise updateNamedQueryAsync(array $args = [])
* @method \Aws\Result updateNotebook(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateNotebookAsync(array $args = [])
* @method \Aws\Result updateNotebookMetadata(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateNotebookMetadataAsync(array $args = [])
* @method \Aws\Result updatePreparedStatement(array $args = []) * @method \Aws\Result updatePreparedStatement(array $args = [])
* @method \GuzzleHttp\Promise\Promise updatePreparedStatementAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise updatePreparedStatementAsync(array $args = [])
* @method \Aws\Result updateWorkGroup(array $args = []) * @method \Aws\Result updateWorkGroup(array $args = [])

View file

@ -12,6 +12,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise attachLoadBalancerTargetGroupsAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise attachLoadBalancerTargetGroupsAsync(array $args = [])
* @method \Aws\Result attachLoadBalancers(array $args = []) * @method \Aws\Result attachLoadBalancers(array $args = [])
* @method \GuzzleHttp\Promise\Promise attachLoadBalancersAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise attachLoadBalancersAsync(array $args = [])
* @method \Aws\Result attachTrafficSources(array $args = [])
* @method \GuzzleHttp\Promise\Promise attachTrafficSourcesAsync(array $args = [])
* @method \Aws\Result batchDeleteScheduledAction(array $args = []) * @method \Aws\Result batchDeleteScheduledAction(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchDeleteScheduledActionAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise batchDeleteScheduledActionAsync(array $args = [])
* @method \Aws\Result batchPutScheduledUpdateGroupAction(array $args = []) * @method \Aws\Result batchPutScheduledUpdateGroupAction(array $args = [])
@ -80,6 +82,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise describeTagsAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise describeTagsAsync(array $args = [])
* @method \Aws\Result describeTerminationPolicyTypes(array $args = []) * @method \Aws\Result describeTerminationPolicyTypes(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeTerminationPolicyTypesAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise describeTerminationPolicyTypesAsync(array $args = [])
* @method \Aws\Result describeTrafficSources(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeTrafficSourcesAsync(array $args = [])
* @method \Aws\Result describeWarmPool(array $args = []) * @method \Aws\Result describeWarmPool(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeWarmPoolAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise describeWarmPoolAsync(array $args = [])
* @method \Aws\Result detachInstances(array $args = []) * @method \Aws\Result detachInstances(array $args = [])
@ -88,6 +92,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise detachLoadBalancerTargetGroupsAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise detachLoadBalancerTargetGroupsAsync(array $args = [])
* @method \Aws\Result detachLoadBalancers(array $args = []) * @method \Aws\Result detachLoadBalancers(array $args = [])
* @method \GuzzleHttp\Promise\Promise detachLoadBalancersAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise detachLoadBalancersAsync(array $args = [])
* @method \Aws\Result detachTrafficSources(array $args = [])
* @method \GuzzleHttp\Promise\Promise detachTrafficSourcesAsync(array $args = [])
* @method \Aws\Result disableMetricsCollection(array $args = []) * @method \Aws\Result disableMetricsCollection(array $args = [])
* @method \GuzzleHttp\Promise\Promise disableMetricsCollectionAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise disableMetricsCollectionAsync(array $args = [])
* @method \Aws\Result enableMetricsCollection(array $args = []) * @method \Aws\Result enableMetricsCollection(array $args = [])
@ -114,6 +120,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise recordLifecycleActionHeartbeatAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise recordLifecycleActionHeartbeatAsync(array $args = [])
* @method \Aws\Result resumeProcesses(array $args = []) * @method \Aws\Result resumeProcesses(array $args = [])
* @method \GuzzleHttp\Promise\Promise resumeProcessesAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise resumeProcessesAsync(array $args = [])
* @method \Aws\Result rollbackInstanceRefresh(array $args = [])
* @method \GuzzleHttp\Promise\Promise rollbackInstanceRefreshAsync(array $args = [])
* @method \Aws\Result setDesiredCapacity(array $args = []) * @method \Aws\Result setDesiredCapacity(array $args = [])
* @method \GuzzleHttp\Promise\Promise setDesiredCapacityAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise setDesiredCapacityAsync(array $args = [])
* @method \Aws\Result setInstanceHealth(array $args = []) * @method \Aws\Result setInstanceHealth(array $args = [])

View file

@ -4,10 +4,8 @@ namespace Aws;
use Aws\Api\ApiProvider; use Aws\Api\ApiProvider;
use Aws\Api\DocModel; use Aws\Api\DocModel;
use Aws\Api\Service; use Aws\Api\Service;
use Aws\ClientSideMonitoring\ApiCallAttemptMonitoringMiddleware;
use Aws\ClientSideMonitoring\ApiCallMonitoringMiddleware;
use Aws\ClientSideMonitoring\ConfigurationProvider;
use Aws\EndpointDiscovery\EndpointDiscoveryMiddleware; use Aws\EndpointDiscovery\EndpointDiscoveryMiddleware;
use Aws\EndpointV2\EndpointProviderV2;
use Aws\Signature\SignatureProvider; use Aws\Signature\SignatureProvider;
use GuzzleHttp\Psr7\Uri; use GuzzleHttp\Psr7\Uri;
@ -39,12 +37,27 @@ class AwsClient implements AwsClientInterface
/** @var callable */ /** @var callable */
private $credentialProvider; private $credentialProvider;
/** @var callable */
private $tokenProvider;
/** @var HandlerList */ /** @var HandlerList */
private $handlerList; private $handlerList;
/** @var array*/ /** @var array*/
private $defaultRequestOptions; private $defaultRequestOptions;
/** @var array*/
private $clientContextParams = [];
/** @var array*/
protected $clientBuiltIns = [];
/** @var EndpointProviderV2 | callable */
protected $endpointProvider;
/** @var callable */
protected $serializer;
/** /**
* Get an array of client constructor arguments used by the client. * Get an array of client constructor arguments used by the client.
* *
@ -71,6 +84,15 @@ class AwsClient implements AwsClientInterface
* credentials or return null. See Aws\Credentials\CredentialProvider for * credentials or return null. See Aws\Credentials\CredentialProvider for
* a list of built-in credentials providers. If no credentials are * a list of built-in credentials providers. If no credentials are
* provided, the SDK will attempt to load them from the environment. * provided, the SDK will attempt to load them from the environment.
* - token:
* (Aws\Token\TokenInterface|array|bool|callable) Specifies
* the token used to authorize requests. Provide an
* Aws\Token\TokenInterface object, an associative array of
* "token" and an optional "expires" key, `false` to use no
* token, or a callable token provider used to create a
* token or return null. See Aws\Token\TokenProvider for
* a list of built-in token providers. If no token is
* provided, the SDK will attempt to load one from the environment.
* - csm: * - csm:
* (Aws\ClientSideMonitoring\ConfigurationInterface|array|callable) Specifies * (Aws\ClientSideMonitoring\ConfigurationInterface|array|callable) Specifies
* the credentials used to sign requests. Provide an * the credentials used to sign requests. Provide an
@ -201,9 +223,14 @@ class AwsClient implements AwsClientInterface
$this->signatureProvider = $config['signature_provider']; $this->signatureProvider = $config['signature_provider'];
$this->endpoint = new Uri($config['endpoint']); $this->endpoint = new Uri($config['endpoint']);
$this->credentialProvider = $config['credentials']; $this->credentialProvider = $config['credentials'];
$this->tokenProvider = $config['token'];
$this->region = isset($config['region']) ? $config['region'] : null; $this->region = isset($config['region']) ? $config['region'] : null;
$this->config = $config['config']; $this->config = $config['config'];
$this->setClientBuiltIns($args);
$this->clientContextParams = $this->setClientContextParams($args);
$this->defaultRequestOptions = $config['http']; $this->defaultRequestOptions = $config['http'];
$this->endpointProvider = $config['endpoint_provider'];
$this->serializer = $config['serializer'];
$this->addSignatureMiddleware(); $this->addSignatureMiddleware();
$this->addInvocationId(); $this->addInvocationId();
$this->addEndpointParameterMiddleware($args); $this->addEndpointParameterMiddleware($args);
@ -211,6 +238,7 @@ class AwsClient implements AwsClientInterface
$this->loadAliases(); $this->loadAliases();
$this->addStreamRequestPayload(); $this->addStreamRequestPayload();
$this->addRecursionDetection(); $this->addRecursionDetection();
$this->addRequestBuilder();
if (isset($args['with_resolved'])) { if (isset($args['with_resolved'])) {
$args['with_resolved']($config); $args['with_resolved']($config);
@ -237,6 +265,7 @@ class AwsClient implements AwsClientInterface
return $fn(); return $fn();
} }
public function getEndpoint() public function getEndpoint()
{ {
return $this->endpoint; return $this->endpoint;
@ -271,6 +300,33 @@ class AwsClient implements AwsClientInterface
return new Command($name, $args, clone $this->getHandlerList()); return new Command($name, $args, clone $this->getHandlerList());
} }
public function getEndpointProvider()
{
return $this->endpointProvider;
}
/**
* Provides the set of service context parameter
* key-value pairs used for endpoint resolution.
*
* @return array
*/
public function getClientContextParams()
{
return $this->clientContextParams;
}
/**
* Provides the set of built-in keys and values
* used for endpoint resolution
*
* @return array
*/
public function getClientBuiltIns()
{
return $this->clientBuiltIns;
}
public function __sleep() public function __sleep()
{ {
throw new \RuntimeException('Instances of ' . static::class throw new \RuntimeException('Instances of ' . static::class
@ -355,6 +411,7 @@ class AwsClient implements AwsClientInterface
if (!empty($c['@context']['signing_service'])) { if (!empty($c['@context']['signing_service'])) {
$name = $c['@context']['signing_service']; $name = $c['@context']['signing_service'];
} }
$authType = $api->getOperation($c->getName())['authtype']; $authType = $api->getOperation($c->getName())['authtype'];
switch ($authType){ switch ($authType){
case 'none': case 'none':
@ -363,16 +420,26 @@ class AwsClient implements AwsClientInterface
case 'v4-unsigned-body': case 'v4-unsigned-body':
$version = 'v4-unsigned-body'; $version = 'v4-unsigned-body';
break; break;
case 'bearer':
$version = 'bearer';
break;
} }
if (isset($c['@context']['signature_version'])) { if (isset($c['@context']['signature_version'])) {
if ($c['@context']['signature_version'] == 'v4a') { if ($c['@context']['signature_version'] == 'v4a') {
$version = 'v4a'; $version = 'v4a';
} }
} }
if (!empty($endpointAuthSchemes = $c->getAuthSchemes())) {
$version = $endpointAuthSchemes['version'];
$name = isset($endpointAuthSchemes['name']) ?
$endpointAuthSchemes['name'] : $name;
$region = isset($endpointAuthSchemes['region']) ?
$endpointAuthSchemes['region'] : $region;
}
return SignatureProvider::resolve($provider, $version, $name, $region); return SignatureProvider::resolve($provider, $version, $name, $region);
}; };
$this->handlerList->appendSign( $this->handlerList->appendSign(
Middleware::signer($this->credentialProvider, $resolver), Middleware::signer($this->credentialProvider, $resolver, $this->tokenProvider),
'signer' 'signer'
); );
} }
@ -419,6 +486,108 @@ class AwsClient implements AwsClientInterface
); );
} }
/**
* Adds the `builder` middleware such that a client's endpoint
* provider and endpoint resolution arguments can be passed.
*/
private function addRequestBuilder()
{
$handlerList = $this->getHandlerList();
$serializer = $this->serializer;
$endpointProvider = $this->endpointProvider;
$endpointArgs = $this->getEndpointProviderArgs();
$handlerList->prependBuild(
Middleware::requestBuilder(
$serializer,
$endpointProvider,
$endpointArgs
),
'builderV2'
);
}
/**
* Retrieves client context param definition from service model,
* creates mapping of client context param names with client-provided
* values.
*
* @return array
*/
private function setClientContextParams($args)
{
$api = $this->getApi();
$resolvedParams = [];
if (!empty($paramDefinitions = $api->getClientContextParams())) {
foreach($paramDefinitions as $paramName => $paramValue) {
if (isset($args[$paramName])) {
$result[$paramName] = $args[$paramName];
}
}
}
return $resolvedParams;
}
/**
* Retrieves and sets default values used for endpoint resolution.
*/
private function setClientBuiltIns($args)
{
$builtIns = [];
$config = $this->getConfig();
$service = $args['service'];
$builtIns['SDK::Endpoint'] = isset($args['endpoint']) ? $args['endpoint'] : null;
$builtIns['AWS::Region'] = $this->getRegion();
$builtIns['AWS::UseFIPS'] = $config['use_fips_endpoint']->isUseFipsEndpoint();
$builtIns['AWS::UseDualStack'] = $config['use_dual_stack_endpoint']->isUseDualstackEndpoint();
if ($service === 's3' || $service === 's3control'){
$builtIns['AWS::S3::UseArnRegion'] = $config['use_arn_region']->isUseArnRegion();
}
if ($service === 's3') {
$builtIns['AWS::S3::UseArnRegion'] = $config['use_arn_region']->isUseArnRegion();
$builtIns['AWS::S3::Accelerate'] = $config['use_accelerate_endpoint'];
$builtIns['AWS::S3::ForcePathStyle'] = $config['use_path_style_endpoint'];
$builtIns['AWS::S3::DisableMultiRegionAccessPoints'] = $config['disable_multiregion_access_points'];
}
$this->clientBuiltIns += $builtIns;
}
/**
* Retrieves arguments to be used in endpoint resolution.
*
* @return array
*/
public function getEndpointProviderArgs()
{
return $this->normalizeEndpointProviderArgs();
}
/**
* Combines built-in and client context parameter values in
* order of specificity. Client context parameter values supersede
* built-in values.
*
* @return array
*/
private function normalizeEndpointProviderArgs()
{
$normalizedBuiltIns = [];
foreach($this->clientBuiltIns as $name => $value) {
$normalizedName = explode('::', $name);
$normalizedName = $normalizedName[count($normalizedName) - 1];
$normalizedBuiltIns[$normalizedName] = $value;
}
return array_merge($normalizedBuiltIns, $this->getClientContextParams());
}
protected function isUseEndpointV2()
{
return $this->endpointProvider instanceof EndpointProviderV2;
}
/** /**
* Returns a service model and doc model with any necessary changes * Returns a service model and doc model with any necessary changes
* applied. * applied.

View file

@ -5,6 +5,8 @@ use Aws\AwsClient;
/** /**
* This client is used to interact with the **AWS Backup** service. * This client is used to interact with the **AWS Backup** service.
* @method \Aws\Result cancelLegalHold(array $args = [])
* @method \GuzzleHttp\Promise\Promise cancelLegalHoldAsync(array $args = [])
* @method \Aws\Result createBackupPlan(array $args = []) * @method \Aws\Result createBackupPlan(array $args = [])
* @method \GuzzleHttp\Promise\Promise createBackupPlanAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise createBackupPlanAsync(array $args = [])
* @method \Aws\Result createBackupSelection(array $args = []) * @method \Aws\Result createBackupSelection(array $args = [])
@ -13,6 +15,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise createBackupVaultAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise createBackupVaultAsync(array $args = [])
* @method \Aws\Result createFramework(array $args = []) * @method \Aws\Result createFramework(array $args = [])
* @method \GuzzleHttp\Promise\Promise createFrameworkAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise createFrameworkAsync(array $args = [])
* @method \Aws\Result createLegalHold(array $args = [])
* @method \GuzzleHttp\Promise\Promise createLegalHoldAsync(array $args = [])
* @method \Aws\Result createReportPlan(array $args = []) * @method \Aws\Result createReportPlan(array $args = [])
* @method \GuzzleHttp\Promise\Promise createReportPlanAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise createReportPlanAsync(array $args = [])
* @method \Aws\Result deleteBackupPlan(array $args = []) * @method \Aws\Result deleteBackupPlan(array $args = [])
@ -57,6 +61,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise describeRestoreJobAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise describeRestoreJobAsync(array $args = [])
* @method \Aws\Result disassociateRecoveryPoint(array $args = []) * @method \Aws\Result disassociateRecoveryPoint(array $args = [])
* @method \GuzzleHttp\Promise\Promise disassociateRecoveryPointAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise disassociateRecoveryPointAsync(array $args = [])
* @method \Aws\Result disassociateRecoveryPointFromParent(array $args = [])
* @method \GuzzleHttp\Promise\Promise disassociateRecoveryPointFromParentAsync(array $args = [])
* @method \Aws\Result exportBackupPlanTemplate(array $args = []) * @method \Aws\Result exportBackupPlanTemplate(array $args = [])
* @method \GuzzleHttp\Promise\Promise exportBackupPlanTemplateAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise exportBackupPlanTemplateAsync(array $args = [])
* @method \Aws\Result getBackupPlan(array $args = []) * @method \Aws\Result getBackupPlan(array $args = [])
@ -71,6 +77,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise getBackupVaultAccessPolicyAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise getBackupVaultAccessPolicyAsync(array $args = [])
* @method \Aws\Result getBackupVaultNotifications(array $args = []) * @method \Aws\Result getBackupVaultNotifications(array $args = [])
* @method \GuzzleHttp\Promise\Promise getBackupVaultNotificationsAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise getBackupVaultNotificationsAsync(array $args = [])
* @method \Aws\Result getLegalHold(array $args = [])
* @method \GuzzleHttp\Promise\Promise getLegalHoldAsync(array $args = [])
* @method \Aws\Result getRecoveryPointRestoreMetadata(array $args = []) * @method \Aws\Result getRecoveryPointRestoreMetadata(array $args = [])
* @method \GuzzleHttp\Promise\Promise getRecoveryPointRestoreMetadataAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise getRecoveryPointRestoreMetadataAsync(array $args = [])
* @method \Aws\Result getSupportedResourceTypes(array $args = []) * @method \Aws\Result getSupportedResourceTypes(array $args = [])
@ -91,10 +99,14 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise listCopyJobsAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise listCopyJobsAsync(array $args = [])
* @method \Aws\Result listFrameworks(array $args = []) * @method \Aws\Result listFrameworks(array $args = [])
* @method \GuzzleHttp\Promise\Promise listFrameworksAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise listFrameworksAsync(array $args = [])
* @method \Aws\Result listLegalHolds(array $args = [])
* @method \GuzzleHttp\Promise\Promise listLegalHoldsAsync(array $args = [])
* @method \Aws\Result listProtectedResources(array $args = []) * @method \Aws\Result listProtectedResources(array $args = [])
* @method \GuzzleHttp\Promise\Promise listProtectedResourcesAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise listProtectedResourcesAsync(array $args = [])
* @method \Aws\Result listRecoveryPointsByBackupVault(array $args = []) * @method \Aws\Result listRecoveryPointsByBackupVault(array $args = [])
* @method \GuzzleHttp\Promise\Promise listRecoveryPointsByBackupVaultAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise listRecoveryPointsByBackupVaultAsync(array $args = [])
* @method \Aws\Result listRecoveryPointsByLegalHold(array $args = [])
* @method \GuzzleHttp\Promise\Promise listRecoveryPointsByLegalHoldAsync(array $args = [])
* @method \Aws\Result listRecoveryPointsByResource(array $args = []) * @method \Aws\Result listRecoveryPointsByResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise listRecoveryPointsByResourceAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise listRecoveryPointsByResourceAsync(array $args = [])
* @method \Aws\Result listReportJobs(array $args = []) * @method \Aws\Result listReportJobs(array $args = [])

View file

@ -15,8 +15,14 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise deleteHypervisorAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise deleteHypervisorAsync(array $args = [])
* @method \Aws\Result disassociateGatewayFromServer(array $args = []) * @method \Aws\Result disassociateGatewayFromServer(array $args = [])
* @method \GuzzleHttp\Promise\Promise disassociateGatewayFromServerAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise disassociateGatewayFromServerAsync(array $args = [])
* @method \Aws\Result getBandwidthRateLimitSchedule(array $args = [])
* @method \GuzzleHttp\Promise\Promise getBandwidthRateLimitScheduleAsync(array $args = [])
* @method \Aws\Result getGateway(array $args = []) * @method \Aws\Result getGateway(array $args = [])
* @method \GuzzleHttp\Promise\Promise getGatewayAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise getGatewayAsync(array $args = [])
* @method \Aws\Result getHypervisor(array $args = [])
* @method \GuzzleHttp\Promise\Promise getHypervisorAsync(array $args = [])
* @method \Aws\Result getHypervisorPropertyMappings(array $args = [])
* @method \GuzzleHttp\Promise\Promise getHypervisorPropertyMappingsAsync(array $args = [])
* @method \Aws\Result getVirtualMachine(array $args = []) * @method \Aws\Result getVirtualMachine(array $args = [])
* @method \GuzzleHttp\Promise\Promise getVirtualMachineAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise getVirtualMachineAsync(array $args = [])
* @method \Aws\Result importHypervisorConfiguration(array $args = []) * @method \Aws\Result importHypervisorConfiguration(array $args = [])
@ -29,8 +35,14 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
* @method \Aws\Result listVirtualMachines(array $args = []) * @method \Aws\Result listVirtualMachines(array $args = [])
* @method \GuzzleHttp\Promise\Promise listVirtualMachinesAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise listVirtualMachinesAsync(array $args = [])
* @method \Aws\Result putBandwidthRateLimitSchedule(array $args = [])
* @method \GuzzleHttp\Promise\Promise putBandwidthRateLimitScheduleAsync(array $args = [])
* @method \Aws\Result putHypervisorPropertyMappings(array $args = [])
* @method \GuzzleHttp\Promise\Promise putHypervisorPropertyMappingsAsync(array $args = [])
* @method \Aws\Result putMaintenanceStartTime(array $args = []) * @method \Aws\Result putMaintenanceStartTime(array $args = [])
* @method \GuzzleHttp\Promise\Promise putMaintenanceStartTimeAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise putMaintenanceStartTimeAsync(array $args = [])
* @method \Aws\Result startVirtualMachinesMetadataSync(array $args = [])
* @method \GuzzleHttp\Promise\Promise startVirtualMachinesMetadataSyncAsync(array $args = [])
* @method \Aws\Result tagResource(array $args = []) * @method \Aws\Result tagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = []) * @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = [])
* @method \Aws\Result testHypervisorConfiguration(array $args = []) * @method \Aws\Result testHypervisorConfiguration(array $args = [])

Some files were not shown because too many files have changed in this diff Show more