diff --git a/CHANGELOG.md b/CHANGELOG.md index 398fc32..e9e108f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ CHANGELOG ========= + +6.30.0 +----- +* Implemented Actions +* Implemented Poll Status command for Actions +* Added progress bar option to specific Actions + 6.29.3 ----- * Added configFile option to all commands. diff --git a/composer.json b/composer.json index e6d147e..e1a2137 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,9 @@ "config": { "platform": { "php": "7.2.5" + }, + "allow-plugins": { + "php-http/discovery": true } }, "minimum-stability": "stable", diff --git a/composer.lock b/composer.lock index 38cc466..0b21485 100644 --- a/composer.lock +++ b/composer.lock @@ -286,16 +286,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "2.4.1", + "version": "2.4.3", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "69568e4293f4fa993f3b0e51c9723e1e17c41379" + "reference": "67c26b443f348a51926030c83481b85718457d3d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/69568e4293f4fa993f3b0e51c9723e1e17c41379", - "reference": "69568e4293f4fa993f3b0e51c9723e1e17c41379", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/67c26b443f348a51926030c83481b85718457d3d", + "reference": "67c26b443f348a51926030c83481b85718457d3d", "shasum": "" }, "require": { @@ -385,7 +385,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.4.1" + "source": "https://github.com/guzzle/psr7/tree/2.4.3" }, "funding": [ { @@ -401,20 +401,20 @@ "type": "tidelift" } ], - "time": "2022-08-28T14:45:39+00:00" + "time": "2022-10-26T14:07:24+00:00" }, { "name": "php-http/client-common", - "version": "2.5.0", + "version": "2.6.0", "source": { "type": "git", "url": "https://github.com/php-http/client-common.git", - "reference": "d135751167d57e27c74de674d6a30cef2dc8e054" + "reference": "45db684cd4e186dcdc2b9c06b22970fe123796c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/client-common/zipball/d135751167d57e27c74de674d6a30cef2dc8e054", - "reference": "d135751167d57e27c74de674d6a30cef2dc8e054", + "url": "https://api.github.com/repos/php-http/client-common/zipball/45db684cd4e186dcdc2b9c06b22970fe123796c0", + "reference": "45db684cd4e186dcdc2b9c06b22970fe123796c0", "shasum": "" }, "require": { @@ -474,44 +474,50 @@ ], "support": { "issues": "https://github.com/php-http/client-common/issues", - "source": "https://github.com/php-http/client-common/tree/2.5.0" + "source": "https://github.com/php-http/client-common/tree/2.6.0" }, - "time": "2021-11-26T15:01:24+00:00" + "time": "2022-09-29T09:59:43+00:00" }, { "name": "php-http/discovery", - "version": "1.14.3", + "version": "1.15.2", "source": { "type": "git", "url": "https://github.com/php-http/discovery.git", - "reference": "31d8ee46d0215108df16a8527c7438e96a4d7735" + "reference": "5cc428320191ac1d0b6520034c2dc0698628ced5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/31d8ee46d0215108df16a8527c7438e96a4d7735", - "reference": "31d8ee46d0215108df16a8527c7438e96a4d7735", + "url": "https://api.github.com/repos/php-http/discovery/zipball/5cc428320191ac1d0b6520034c2dc0698628ced5", + "reference": "5cc428320191ac1d0b6520034c2dc0698628ced5", "shasum": "" }, "require": { + "composer-plugin-api": "^1.0|^2.0", "php": "^7.1 || ^8.0" }, "conflict": { "nyholm/psr7": "<1.0" }, + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "*", + "psr/http-factory-implementation": "*", + "psr/http-message-implementation": "*" + }, "require-dev": { + "composer/composer": "^1.0.2|^2.0", "graham-campbell/phpspec-skip-example-extension": "^5.0", "php-http/httplug": "^1.0 || ^2.0", "php-http/message-factory": "^1.0", - "phpspec/phpspec": "^5.1 || ^6.1" - }, - "suggest": { - "php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories" + "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3", + "symfony/phpunit-bridge": "^6.2" }, - "type": "library", + "type": "composer-plugin", "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } + "class": "Http\\Discovery\\Composer\\Plugin", + "plugin-optional": true }, "autoload": { "psr-4": { @@ -528,7 +534,7 @@ "email": "mark.sagikazar@gmail.com" } ], - "description": "Finds installed HTTPlug implementations and PSR-7 message factories", + "description": "Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations", "homepage": "http://php-http.org", "keywords": [ "adapter", @@ -537,13 +543,14 @@ "factory", "http", "message", + "psr17", "psr7" ], "support": { "issues": "https://github.com/php-http/discovery/issues", - "source": "https://github.com/php-http/discovery/tree/1.14.3" + "source": "https://github.com/php-http/discovery/tree/1.15.2" }, - "time": "2022-07-11T14:04:40+00:00" + "time": "2023-02-11T08:28:41+00:00" }, { "name": "php-http/httplug", @@ -1145,16 +1152,16 @@ }, { "name": "symfony/cache", - "version": "v5.4.11", + "version": "v5.4.19", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "5a0fff46df349f0db3fe242263451fddf5277362" + "reference": "e9147c89fdfdc5d5ef798bb7193f23726ad609f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/5a0fff46df349f0db3fe242263451fddf5277362", - "reference": "5a0fff46df349f0db3fe242263451fddf5277362", + "url": "https://api.github.com/repos/symfony/cache/zipball/e9147c89fdfdc5d5ef798bb7193f23726ad609f5", + "reference": "e9147c89fdfdc5d5ef798bb7193f23726ad609f5", "shasum": "" }, "require": { @@ -1215,14 +1222,14 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Provides an extended PSR-6, PSR-16 (and tags) implementation", + "description": "Provides extended PSR-6, PSR-16 (and tags) implementations", "homepage": "https://symfony.com", "keywords": [ "caching", "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v5.4.11" + "source": "https://github.com/symfony/cache/tree/v5.4.19" }, "funding": [ { @@ -1238,7 +1245,7 @@ "type": "tidelift" } ], - "time": "2022-07-28T15:25:17+00:00" + "time": "2023-01-19T09:49:58+00:00" }, { "name": "symfony/cache-contracts", @@ -1321,16 +1328,16 @@ }, { "name": "symfony/console", - "version": "v5.4.12", + "version": "v5.4.19", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "c072aa8f724c3af64e2c7a96b796a4863d24dba1" + "reference": "dccb8d251a9017d5994c988b034d3e18aaabf740" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/c072aa8f724c3af64e2c7a96b796a4863d24dba1", - "reference": "c072aa8f724c3af64e2c7a96b796a4863d24dba1", + "url": "https://api.github.com/repos/symfony/console/zipball/dccb8d251a9017d5994c988b034d3e18aaabf740", + "reference": "dccb8d251a9017d5994c988b034d3e18aaabf740", "shasum": "" }, "require": { @@ -1400,7 +1407,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.12" + "source": "https://github.com/symfony/console/tree/v5.4.19" }, "funding": [ { @@ -1416,7 +1423,7 @@ "type": "tidelift" } ], - "time": "2022-08-17T13:18:05+00:00" + "time": "2023-01-01T08:32:19+00:00" }, { "name": "symfony/deprecation-contracts", @@ -1487,16 +1494,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.4.12", + "version": "v5.4.19", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "2d67c1f9a1937406a9be3171b4b22250c0a11447" + "reference": "648bfaca6a494f3e22378123bcee2894045dc9d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/2d67c1f9a1937406a9be3171b4b22250c0a11447", - "reference": "2d67c1f9a1937406a9be3171b4b22250c0a11447", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/648bfaca6a494f3e22378123bcee2894045dc9d8", + "reference": "648bfaca6a494f3e22378123bcee2894045dc9d8", "shasum": "" }, "require": { @@ -1531,7 +1538,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.12" + "source": "https://github.com/symfony/filesystem/tree/v5.4.19" }, "funding": [ { @@ -1547,20 +1554,20 @@ "type": "tidelift" } ], - "time": "2022-08-02T13:48:16+00:00" + "time": "2023-01-14T19:14:44+00:00" }, { "name": "symfony/finder", - "version": "v5.4.11", + "version": "v5.4.19", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "7872a66f57caffa2916a584db1aa7f12adc76f8c" + "reference": "6071aebf810ad13fe8200c224f36103abb37cf1f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/7872a66f57caffa2916a584db1aa7f12adc76f8c", - "reference": "7872a66f57caffa2916a584db1aa7f12adc76f8c", + "url": "https://api.github.com/repos/symfony/finder/zipball/6071aebf810ad13fe8200c224f36103abb37cf1f", + "reference": "6071aebf810ad13fe8200c224f36103abb37cf1f", "shasum": "" }, "require": { @@ -1594,7 +1601,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.11" + "source": "https://github.com/symfony/finder/tree/v5.4.19" }, "funding": [ { @@ -1610,20 +1617,20 @@ "type": "tidelift" } ], - "time": "2022-07-29T07:37:50+00:00" + "time": "2023-01-14T19:14:44+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.4.11", + "version": "v5.4.19", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "54f14e36aa73cb8f7261d7686691fd4d75ea2690" + "reference": "b03c99236445492f20c61666e8f7e5d388b078e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/54f14e36aa73cb8f7261d7686691fd4d75ea2690", - "reference": "54f14e36aa73cb8f7261d7686691fd4d75ea2690", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/b03c99236445492f20c61666e8f7e5d388b078e5", + "reference": "b03c99236445492f20c61666e8f7e5d388b078e5", "shasum": "" }, "require": { @@ -1663,7 +1670,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.4.11" + "source": "https://github.com/symfony/options-resolver/tree/v5.4.19" }, "funding": [ { @@ -1679,20 +1686,20 @@ "type": "tidelift" } ], - "time": "2022-07-20T13:00:38+00:00" + "time": "2023-01-01T08:32:19+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4" + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", - "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", "shasum": "" }, "require": { @@ -1707,7 +1714,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1745,7 +1752,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" }, "funding": [ { @@ -1761,20 +1768,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "433d05519ce6990bf3530fba6957499d327395c2" + "reference": "511a08c03c1960e08a883f4cffcacd219b758354" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/433d05519ce6990bf3530fba6957499d327395c2", - "reference": "433d05519ce6990bf3530fba6957499d327395c2", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", + "reference": "511a08c03c1960e08a883f4cffcacd219b758354", "shasum": "" }, "require": { @@ -1786,7 +1793,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1826,7 +1833,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" }, "funding": [ { @@ -1842,20 +1849,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "219aa369ceff116e673852dce47c3a41794c14bd" + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/219aa369ceff116e673852dce47c3a41794c14bd", - "reference": "219aa369ceff116e673852dce47c3a41794c14bd", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", "shasum": "" }, "require": { @@ -1867,7 +1874,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1910,7 +1917,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" }, "funding": [ { @@ -1926,20 +1933,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", "shasum": "" }, "require": { @@ -1954,7 +1961,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1993,7 +2000,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" }, "funding": [ { @@ -2009,20 +2016,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85" + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/e440d35fa0286f77fb45b79a03fedbeda9307e85", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", "shasum": "" }, "require": { @@ -2031,7 +2038,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2072,7 +2079,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" }, "funding": [ { @@ -2088,20 +2095,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", "shasum": "" }, "require": { @@ -2110,7 +2117,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2155,7 +2162,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" }, "funding": [ { @@ -2171,7 +2178,7 @@ "type": "tidelift" } ], - "time": "2022-05-10T07:21:04+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/service-contracts", @@ -2258,16 +2265,16 @@ }, { "name": "symfony/string", - "version": "v5.4.12", + "version": "v5.4.19", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "2fc515e512d721bf31ea76bd02fe23ada4640058" + "reference": "0a01071610fd861cc160dfb7e2682ceec66064cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/2fc515e512d721bf31ea76bd02fe23ada4640058", - "reference": "2fc515e512d721bf31ea76bd02fe23ada4640058", + "url": "https://api.github.com/repos/symfony/string/zipball/0a01071610fd861cc160dfb7e2682ceec66064cb", + "reference": "0a01071610fd861cc160dfb7e2682ceec66064cb", "shasum": "" }, "require": { @@ -2324,7 +2331,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.12" + "source": "https://github.com/symfony/string/tree/v5.4.19" }, "funding": [ { @@ -2340,20 +2347,20 @@ "type": "tidelift" } ], - "time": "2022-08-12T17:03:11+00:00" + "time": "2023-01-01T08:32:19+00:00" }, { "name": "symfony/var-exporter", - "version": "v5.4.10", + "version": "v5.4.19", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "8fc03ee75eeece3d9be1ef47d26d79bea1afb340" + "reference": "2a1d06fcf2b30829d6c01dae8e6e188424d1f8f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/8fc03ee75eeece3d9be1ef47d26d79bea1afb340", - "reference": "8fc03ee75eeece3d9be1ef47d26d79bea1afb340", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/2a1d06fcf2b30829d6c01dae8e6e188424d1f8f6", + "reference": "2a1d06fcf2b30829d6c01dae8e6e188424d1f8f6", "shasum": "" }, "require": { @@ -2397,7 +2404,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v5.4.10" + "source": "https://github.com/symfony/var-exporter/tree/v5.4.19" }, "funding": [ { @@ -2413,20 +2420,20 @@ "type": "tidelift" } ], - "time": "2022-05-27T12:56:18+00:00" + "time": "2023-01-12T16:39:29+00:00" }, { "name": "symfony/yaml", - "version": "v5.4.12", + "version": "v5.4.19", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "7a3aa21ac8ab1a96cc6de5bbcab4bc9fc943b18c" + "reference": "71c05db20cb9b54d381a28255f17580e2b7e36a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/7a3aa21ac8ab1a96cc6de5bbcab4bc9fc943b18c", - "reference": "7a3aa21ac8ab1a96cc6de5bbcab4bc9fc943b18c", + "url": "https://api.github.com/repos/symfony/yaml/zipball/71c05db20cb9b54d381a28255f17580e2b7e36a5", + "reference": "71c05db20cb9b54d381a28255f17580e2b7e36a5", "shasum": "" }, "require": { @@ -2472,7 +2479,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v5.4.12" + "source": "https://github.com/symfony/yaml/tree/v5.4.19" }, "funding": [ { @@ -2488,20 +2495,20 @@ "type": "tidelift" } ], - "time": "2022-08-02T15:52:22+00:00" + "time": "2023-01-10T18:51:14+00:00" }, { "name": "transip/transip-api-php", - "version": "6.29.2", + "version": "6.33.0", "source": { "type": "git", "url": "https://github.com/transip/transip-api-php.git", - "reference": "03710938e76605e32d7cfd518a2351a8f15449db" + "reference": "c8988d9e7bd4b4fe0ef94ee6fa5b9fdad1df8d82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/transip/transip-api-php/zipball/03710938e76605e32d7cfd518a2351a8f15449db", - "reference": "03710938e76605e32d7cfd518a2351a8f15449db", + "url": "https://api.github.com/repos/transip/transip-api-php/zipball/c8988d9e7bd4b4fe0ef94ee6fa5b9fdad1df8d82", + "reference": "c8988d9e7bd4b4fe0ef94ee6fa5b9fdad1df8d82", "shasum": "" }, "require": { @@ -2545,9 +2552,9 @@ "description": "TransIP Rest API Library", "support": { "issues": "https://github.com/transip/transip-api-php/issues", - "source": "https://github.com/transip/transip-api-php/tree/6.29.2" + "source": "https://github.com/transip/transip-api-php/tree/6.33.0" }, - "time": "2022-10-10T11:50:39+00:00" + "time": "2023-02-16T15:16:35+00:00" } ], "packages-dev": [ @@ -2771,32 +2778,35 @@ }, { "name": "doctrine/annotations", - "version": "1.13.3", + "version": "1.14.3", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "648b0343343565c4a056bfc8392201385e8d89f0" + "reference": "fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/648b0343343565c4a056bfc8392201385e8d89f0", - "reference": "648b0343343565c4a056bfc8392201385e8d89f0", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af", + "reference": "fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af", "shasum": "" }, "require": { - "doctrine/lexer": "1.*", + "doctrine/lexer": "^1 || ^2", "ext-tokenizer": "*", "php": "^7.1 || ^8.0", "psr/cache": "^1 || ^2 || ^3" }, "require-dev": { "doctrine/cache": "^1.11 || ^2.0", - "doctrine/coding-standard": "^6.0 || ^8.1", - "phpstan/phpstan": "^1.4.10 || ^1.8.0", - "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", - "symfony/cache": "^4.4 || ^5.2", + "doctrine/coding-standard": "^9 || ^10", + "phpstan/phpstan": "~1.4.10 || ^1.8.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "symfony/cache": "^4.4 || ^5.4 || ^6", "vimeo/psalm": "^4.10" }, + "suggest": { + "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" + }, "type": "library", "autoload": { "psr-4": { @@ -2838,37 +2848,82 @@ ], "support": { "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/1.13.3" + "source": "https://github.com/doctrine/annotations/tree/1.14.3" + }, + "time": "2023-02-01T09:20:38+00:00" + }, + { + "name": "doctrine/deprecations", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "shasum": "" + }, + "require": { + "php": "^7.1|^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5|^8.5|^9.5", + "psr/log": "^1|^2|^3" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" }, - "time": "2022-07-02T10:48:51+00:00" + "time": "2022-05-02T15:47:09+00:00" }, { "name": "doctrine/lexer", - "version": "1.2.3", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229" + "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229", - "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", + "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", "shasum": "" }, "require": { + "doctrine/deprecations": "^1.0", "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^9.0", + "doctrine/coding-standard": "^9 || ^10", "phpstan/phpstan": "^1.3", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.11" + "psalm/plugin-phpunit": "^0.18.3", + "vimeo/psalm": "^4.11 || ^5.0" }, "type": "library", "autoload": { "psr-4": { - "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" + "Doctrine\\Common\\Lexer\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -2900,7 +2955,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/1.2.3" + "source": "https://github.com/doctrine/lexer/tree/2.1.0" }, "funding": [ { @@ -2916,7 +2971,7 @@ "type": "tidelift" } ], - "time": "2022-02-28T11:07:21+00:00" + "time": "2022-12-14T08:49:07+00:00" }, { "name": "friendsofphp/php-cs-fixer", @@ -3119,16 +3174,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.8.4", + "version": "1.9.17", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "eed4c9da531f6ebb4787235b6fb486e2c20f34e5" + "reference": "204e459e7822f2c586463029f5ecec31bb45a1f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/eed4c9da531f6ebb4787235b6fb486e2c20f34e5", - "reference": "eed4c9da531f6ebb4787235b6fb486e2c20f34e5", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/204e459e7822f2c586463029f5ecec31bb45a1f2", + "reference": "204e459e7822f2c586463029f5ecec31bb45a1f2", "shasum": "" }, "require": { @@ -3158,7 +3213,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.4" + "source": "https://github.com/phpstan/phpstan/tree/1.9.17" }, "funding": [ { @@ -3174,7 +3229,7 @@ "type": "tidelift" } ], - "time": "2022-09-03T13:08:04+00:00" + "time": "2023-02-08T12:25:00+00:00" }, { "name": "psr/event-dispatcher", @@ -3288,16 +3343,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v5.4.9", + "version": "v5.4.19", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc" + "reference": "abf49cc084c087d94b4cb939c3f3672971784e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc", - "reference": "8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/abf49cc084c087d94b4cb939c3f3672971784e0c", + "reference": "abf49cc084c087d94b4cb939c3f3672971784e0c", "shasum": "" }, "require": { @@ -3353,7 +3408,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.9" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.19" }, "funding": [ { @@ -3369,7 +3424,7 @@ "type": "tidelift" } ], - "time": "2022-05-05T16:45:39+00:00" + "time": "2023-01-01T08:32:19+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -3452,16 +3507,16 @@ }, { "name": "symfony/polyfill-php81", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1" + "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/13f6d1271c663dc5ae9fb843a8f16521db7687a1", - "reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/707403074c8ea6e2edaf8794b0157a0bfa52157a", + "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a", "shasum": "" }, "require": { @@ -3470,7 +3525,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3511,7 +3566,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.27.0" }, "funding": [ { @@ -3527,20 +3582,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/process", - "version": "v5.4.11", + "version": "v5.4.19", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "6e75fe6874cbc7e4773d049616ab450eff537bf1" + "reference": "c5ba874c9b636dbccf761e22ce750e88ec3f55e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/6e75fe6874cbc7e4773d049616ab450eff537bf1", - "reference": "6e75fe6874cbc7e4773d049616ab450eff537bf1", + "url": "https://api.github.com/repos/symfony/process/zipball/c5ba874c9b636dbccf761e22ce750e88ec3f55e1", + "reference": "c5ba874c9b636dbccf761e22ce750e88ec3f55e1", "shasum": "" }, "require": { @@ -3573,7 +3628,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.11" + "source": "https://github.com/symfony/process/tree/v5.4.19" }, "funding": [ { @@ -3589,20 +3644,20 @@ "type": "tidelift" } ], - "time": "2022-06-27T16:58:25+00:00" + "time": "2023-01-01T08:32:19+00:00" }, { "name": "symfony/stopwatch", - "version": "v5.4.5", + "version": "v5.4.19", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "4d04b5c24f3c9a1a168a131f6cbe297155bc0d30" + "reference": "bd2b066090fd6a67039371098fa25a84cb2679ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/4d04b5c24f3c9a1a168a131f6cbe297155bc0d30", - "reference": "4d04b5c24f3c9a1a168a131f6cbe297155bc0d30", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/bd2b066090fd6a67039371098fa25a84cb2679ec", + "reference": "bd2b066090fd6a67039371098fa25a84cb2679ec", "shasum": "" }, "require": { @@ -3635,7 +3690,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v5.4.5" + "source": "https://github.com/symfony/stopwatch/tree/v5.4.19" }, "funding": [ { @@ -3651,7 +3706,7 @@ "type": "tidelift" } ], - "time": "2022-02-18T16:06:09+00:00" + "time": "2023-01-01T08:32:19+00:00" } ], "aliases": [], @@ -3667,5 +3722,5 @@ "platform-overrides": { "php": "7.2.5" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.2.0" } diff --git a/src/Command/Action/ChildAction/GetByParentUuid.php b/src/Command/Action/ChildAction/GetByParentUuid.php new file mode 100644 index 0000000..205478a --- /dev/null +++ b/src/Command/Action/ChildAction/GetByParentUuid.php @@ -0,0 +1,28 @@ +setName('action:children:getbyparentuuid') + ->setDescription('Allows you to list all child actions for a parent action') + ->addArgument(Field::ACTION_UUID, InputArgument::REQUIRED, Field::ACTION_UUID__DESC) + ->setHelp('This command displays all child actions for a specific parent action'); + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $actionUuid = $input->getArgument('parentUuid'); + $actions = $this->getTransipApi()->childActions()->getByParentUuid($actionUuid); + $this->output($actions); + return 0; + } +} diff --git a/src/Command/Action/GetAll.php b/src/Command/Action/GetAll.php new file mode 100644 index 0000000..863ff64 --- /dev/null +++ b/src/Command/Action/GetAll.php @@ -0,0 +1,24 @@ +setName('action:getall') + ->setDescription('Lists all your actions') + ->setHelp('This command displays all available zones where you can order a product.'); + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $actions = $this->getTransipApi()->actions()->getAll(); + $this->output($actions); + return 0; + } +} diff --git a/src/Command/Action/GetByUuid.php b/src/Command/Action/GetByUuid.php new file mode 100644 index 0000000..52bb438 --- /dev/null +++ b/src/Command/Action/GetByUuid.php @@ -0,0 +1,26 @@ +setName('action:getbyuuid') + ->setDescription('Request action information by uuid') + ->setHelp('This command displays all information about a specific action'); + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $actionUuid = $input->getArgument(Field::ACTION_UUID); + $action = $this->getTransipApi()->actions()->getByUuid($actionUuid); + $this->output($action); + return 0; + } +} diff --git a/src/Command/Action/PollStatus.php b/src/Command/Action/PollStatus.php new file mode 100644 index 0000000..3b21e03 --- /dev/null +++ b/src/Command/Action/PollStatus.php @@ -0,0 +1,87 @@ +setName('action:pollstatus') + ->setDescription('poll the status of an action by uuid') + ->addArgument(Field::ACTION_UUID, InputArgument::REQUIRED, Field::ACTION_UUID__DESC) + ->addOption(Field::ACTION_POLL_TIME, 'i', InputOption::VALUE_OPTIONAL, Field::ACTION_POLL_TIME_DESC, 30) + ->addOption(Field::ACTION_PROGRESS, 'p', InputOption::VALUE_NONE, Field::ACTION_PROGRESS_DESC) + ->setHelp('This command waits and polls an action until its finished and returns the metadata of the action.'); + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $actionUuid = $input->getArgument(Field::ACTION_UUID); + $pollRetryTime = $input->getOption(Field::ACTION_POLL_TIME); + $showProgress = $input->getOption(Field::ACTION_PROGRESS); + + if ($showProgress) { + return $this->showProgressBar($output, $actionUuid, (int)$pollRetryTime); + } + + return $this->showMetaData($actionUuid, (int)$pollRetryTime); + } + + private function showProgressBar(OutputInterface $output, string $actionUuid, int $pollRetryTime): int + { + $this->returnActionInfo($actionUuid); + + $progressBar = $this->setupProgressBar($output); + $progressBar->start(); + + while (true) { + $action = $this->getTransipApi()->actions()->getByUuid($actionUuid); + if ($action->getStatus() === Action::STATUS_FINISHED) { + $progressBar->finish(); + return 0; + } + $actionProgress = $action->getMetadata(); + $progressBar->setProgress((int)$actionProgress["progress"]); + sleep($pollRetryTime); + } + } + + private function showMetaData(string $actionUuid, int $pollRetryTime): int + { + while (true) { + $action = $this->getTransipApi()->actions()->getByUuid($actionUuid); + if ($action->getStatus() === Action::STATUS_FINISHED) { + $this->output($action); + return 0; + } + sleep($pollRetryTime); + } + } + + private function setupProgressBar(OutputInterface $output): ProgressBar + { + $progressBar = new ProgressBar($output); + $progressBar->setMaxSteps(100); + $progressBar->setBarCharacter('█'); + $progressBar->setEmptyBarCharacter("▁"); + $progressBar->setProgressCharacter('█'); + return $progressBar; + } + + private function returnActionInfo(string $actionUuid): void + { + $action = $this->getTransipApi()->actions()->getByUuid($actionUuid); + $actionInfo = sprintf("Polling action %s with uuid %s", $action->getName(), $action->getUuid()); + + $this->output($actionInfo); + } +} diff --git a/src/Command/BigStorage/AttachVps.php b/src/Command/BigStorage/AttachVps.php index be46345..516ae07 100644 --- a/src/Command/BigStorage/AttachVps.php +++ b/src/Command/BigStorage/AttachVps.php @@ -3,11 +3,13 @@ namespace Transip\Api\CLI\Command\BigStorage; +use Transip\Api\CLI\Command\Field; +use Transip\Api\CLI\Command\AbstractCommand; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Transip\Api\CLI\Command\AbstractCommand; -use Transip\Api\CLI\Command\Field; class AttachVps extends AbstractCommand { @@ -17,6 +19,7 @@ protected function configure(): void ->setDescription('Attach your big storage to your vps') ->addArgument(Field::BIGSTORAGE_NAME, InputArgument::REQUIRED, Field::BIGSTORAGE_NAME__DESC) ->addArgument(Field::VPS_NAME, InputArgument::REQUIRED, 'Name of the vps that the big storage should attach to.') + ->addOption(Field::ACTION_WAIT, 'w', InputOption::VALUE_NONE, Field::ACTION_WAIT_DESC) ->setHelp('This command will attach your big storage to your vps.'); } @@ -24,11 +27,30 @@ protected function execute(InputInterface $input, OutputInterface $output): int { $bigStorageName = $input->getArgument(Field::BIGSTORAGE_NAME); $bigStorageVpsName = $input->getArgument(Field::VPS_NAME); + $waitForAction = $input->getOption(Field::ACTION_WAIT); $bigStorage = $this->getTransipApi()->bigStorages()->getByName($bigStorageName); $bigStorage->setVpsName($bigStorageVpsName); - $this->getTransipApi()->bigStorages()->update($bigStorage); + $response = $this->getTransipApi()->bigStorages()->update($bigStorage); + $action = $this->getTransipApi()->actions()->parseActionFromResponse($response); + + if ($action && $waitForAction) { + $app = $this->getApplication(); + + if (!$app) { + return 0; + } + + $command = $app->get('action:pollstatus'); + + $arguments = [ + 'actionUuid' => $action->getUuid() + ]; + + $actionInput = new ArrayInput($arguments); + $command->run($actionInput, $output); + } return 0; } } diff --git a/src/Command/BigStorage/Backup/Revert.php b/src/Command/BigStorage/Backup/Revert.php index daccdf4..2792d73 100644 --- a/src/Command/BigStorage/Backup/Revert.php +++ b/src/Command/BigStorage/Backup/Revert.php @@ -2,11 +2,13 @@ namespace Transip\Api\CLI\Command\BigStorage\Backup; +use Transip\Api\CLI\Command\Field; +use Transip\Api\CLI\Command\AbstractCommand; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Transip\Api\CLI\Command\AbstractCommand; -use Transip\Api\CLI\Command\Field; class Revert extends AbstractCommand { @@ -17,6 +19,8 @@ protected function configure(): void ->addArgument(Field::BIGSTORAGE_NAME, InputArgument::REQUIRED, Field::BIGSTORAGE_NAME__DESC) ->addArgument(Field::BIGSTORAGE_BACKUPID, InputArgument::REQUIRED, Field::BIGSTORAGE_BACKUPID__DESC) ->addArgument(Field::BIGSTORAGE_BACKUP_DESTINATION_NAME, InputArgument::OPTIONAL, Field::BIGSTORAGE_BACKUP_DESTINATION_NAME__DESC . Field::OPTIONAL) + ->addOption(Field::ACTION_WAIT, 'w', InputOption::VALUE_NONE, Field::ACTION_WAIT_DESC) + ->addOption(Field::ACTION_PROGRESS, 'p', InputOption::VALUE_NONE, Field::ACTION_PROGRESS_DESC) ->setHelp('This command restores a big storage backup.'); } @@ -25,12 +29,35 @@ protected function execute(InputInterface $input, OutputInterface $output): int $bigStorageName = $input->getArgument(Field::BIGSTORAGE_NAME); $bigStorageBackupId = $input->getArgument(Field::BIGSTORAGE_BACKUPID); $destinationBigStorageName = $input->getArgument(Field::BIGSTORAGE_BACKUP_DESTINATION_NAME) ?? ''; + $waitForAction = $input->getOption(Field::ACTION_WAIT); + $showProgress = $input->getOption(Field::ACTION_PROGRESS); - $this->getTransipApi()->bigStorageBackups()->revertBackup( + $response = $this->getTransipApi()->bigStorageBackups()->revertBackup( $bigStorageName, $bigStorageBackupId, $destinationBigStorageName ); + $action = $this->getTransipApi()->actions()->parseActionFromResponse($response); + + + if ($action && $waitForAction) { + $app = $this->getApplication(); + if (!$app) { + return 0; + } + + $command = $app->get('action:pollstatus'); + $arguments = [ + 'actionUuid' => $action->getUuid() + ]; + + if ($showProgress) { + $arguments['--showProgress'] = true; + } + + $actionInput = new ArrayInput($arguments); + $command->run($actionInput, $output); + } return 0; } } diff --git a/src/Command/BigStorage/DetachVps.php b/src/Command/BigStorage/DetachVps.php index 889aaba..f15913f 100644 --- a/src/Command/BigStorage/DetachVps.php +++ b/src/Command/BigStorage/DetachVps.php @@ -3,11 +3,13 @@ namespace Transip\Api\CLI\Command\BigStorage; +use Transip\Api\CLI\Command\Field; +use Transip\Api\CLI\Command\AbstractCommand; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Transip\Api\CLI\Command\AbstractCommand; -use Transip\Api\CLI\Command\Field; class DetachVps extends AbstractCommand { @@ -16,17 +18,37 @@ protected function configure(): void $this->setName('bigstorage:detachvps') ->setDescription('Detach your big storage to your vps') ->addArgument(Field::BIGSTORAGE_NAME, InputArgument::REQUIRED, Field::BIGSTORAGE_NAME__DESC) + ->addOption(Field::ACTION_WAIT, 'w', InputOption::VALUE_NONE, Field::ACTION_WAIT_DESC) ->setHelp('This command will detach your big storage from your vps.'); } protected function execute(InputInterface $input, OutputInterface $output): int { $bigStorageName = $input->getArgument(Field::BIGSTORAGE_NAME); + $waitForAction = $input->getOption(Field::ACTION_WAIT); $bigStorage = $this->getTransipApi()->bigStorages()->getByName($bigStorageName); $bigStorage->setVpsName(''); - $this->getTransipApi()->bigStorages()->update($bigStorage); + $response = $this->getTransipApi()->bigStorages()->update($bigStorage); + $action = $this->getTransipApi()->actions()->parseActionFromResponse($response); + + if ($action && $waitForAction) { + $app = $this->getApplication(); + + if (!$app) { + return 0; + } + + $command = $app->get('action:pollstatus'); + + $arguments = [ + 'actionUuid' => $action->getUuid() + ]; + + $actionInput = new ArrayInput($arguments); + $command->run($actionInput, $output); + } return 0; } } diff --git a/src/Command/BigStorage/Order.php b/src/Command/BigStorage/Order.php index 2f15ba7..e4b2307 100644 --- a/src/Command/BigStorage/Order.php +++ b/src/Command/BigStorage/Order.php @@ -3,11 +3,13 @@ namespace Transip\Api\CLI\Command\BigStorage; +use Transip\Api\CLI\Command\Field; +use Transip\Api\CLI\Command\AbstractCommand; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Transip\Api\CLI\Command\AbstractCommand; -use Transip\Api\CLI\Command\Field; class Order extends AbstractCommand { @@ -20,6 +22,7 @@ protected function configure(): void ->addArgument(Field::AVAILABILITY_ZONE, InputArgument::OPTIONAL, Field::BIGSTORAGE_VPS_AVAILABILITY_ZONE__DESC . Field::OPTIONAL) ->addArgument(Field::VPS_NAME, InputArgument::OPTIONAL, Field::BIGSTORAGE_VPS_ATTACH__DESC . Field::OPTIONAL) ->addArgument(Field::BIGSTORAGE_DESCRIPTION, InputArgument::OPTIONAL, FIELD::BIGSTORAGE_DESCRIPTION__DESC . Field::OPTIONAL) + ->addOption(Field::ACTION_WAIT, 'w', InputOption::VALUE_NONE, Field::ACTION_WAIT_DESC) ->setHelp('This command allows you to order a new big storage'); } @@ -32,8 +35,27 @@ protected function execute(InputInterface $input, OutputInterface $output): int $bigStorageAvailabiltyZone = $input->getArgument(Field::AVAILABILITY_ZONE) ?? ''; $bigStorageVpsName = $input->getArgument(Field::VPS_NAME) ?? ''; $bigStorageDescription = $input->getArgument(Field::BIGSTORAGE_DESCRIPTION) ?? ''; + $waitForAction = $input->getOption(Field::ACTION_WAIT); + + $response = $this->getTransipApi()->bigStorages()->order($bigStorageSize, $bigStorageHasOffSiteBackups, $bigStorageAvailabiltyZone, $bigStorageVpsName, $bigStorageDescription); + $action = $this->getTransipApi()->actions()->parseActionFromResponse($response); + + if ($action && $waitForAction) { + $app = $this->getApplication(); + + if (!$app) { + return 0; + } + + $command = $app->get('action:pollstatus'); + + $arguments = [ + 'actionUuid' => $action->getUuid() + ]; - $this->getTransipApi()->bigStorages()->order($bigStorageSize, $bigStorageHasOffSiteBackups, $bigStorageAvailabiltyZone, $bigStorageVpsName, $bigStorageDescription); + $actionInput = new ArrayInput($arguments); + $command->run($actionInput, $output); + } return 0; } } diff --git a/src/Command/Field.php b/src/Command/Field.php index 91de2ea..e6058ac 100644 --- a/src/Command/Field.php +++ b/src/Command/Field.php @@ -356,6 +356,15 @@ class Field public const OPERATING_SYSTEM_FILTER_ADDONS = 'addons'; public const OPERATING_SYSTEM_FILTER_ADDONS__DESC = 'List of additonal vps addons that will be added to the vps'; + public const ACTION_UUID = 'actionUuid'; + public const ACTION_UUID__DESC = 'The uuid of the action'; + public const ACTION_PROGRESS = 'showProgress'; + public const ACTION_PROGRESS_DESC = 'Wait for the action to finish and show progress if applicable'; + public const ACTION_WAIT = 'waitForAction'; + public const ACTION_WAIT_DESC = 'Wait for the action to finish and show metadata if applicable'; + public const ACTION_POLL_TIME = 'pollRetryTime'; + public const ACTION_POLL_TIME_DESC = 'Allows you to set a poll time in seconds'; + public const INCLUDE = 'include'; public const INCLUDE__DESC = 'Data to include in the response'; diff --git a/src/Command/Haip/Order.php b/src/Command/Haip/Order.php index 6d4287e..158f8b8 100644 --- a/src/Command/Haip/Order.php +++ b/src/Command/Haip/Order.php @@ -2,12 +2,13 @@ namespace Transip\Api\CLI\Command\Haip; +use Transip\Api\CLI\Command\Field; +use Transip\Api\CLI\Command\AbstractCommand; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Transip\Api\CLI\Command\AbstractCommand; -use Transip\Api\CLI\Command\Field; class Order extends AbstractCommand { @@ -23,27 +24,27 @@ protected function configure(): void protected function execute(InputInterface $input, OutputInterface $output): int { $productName = $input->getArgument(Field::PRODUCT_NAME); - $description = $input->getArgument(Field::HAIP_DESCRIPTION); + $description = $input->getArgument(Field::HAIP_DESCRIPTION) ?? ''; $shouldWaitForDelivery = $input->getOption(Field::HAIP_WAIT_FOR_DELIVERY); - if ($description && $shouldWaitForDelivery) { - $haipsBeforeOrder = $this->getTransipApi()->haip()->findByDescription($description); - $this->getTransipApi()->haip()->order($productName, $description); + $response = $this->getTransipApi()->haip()->order($productName, $description); + $action = $this->getTransipApi()->actions()->parseActionFromResponse($response); - while (true) { - sleep(1); - $haips = $this->getTransipApi()->haip()->findByDescription($description); + if ($action && $shouldWaitForDelivery) { + $app = $this->getApplication(); + + if (!$app) { + return 0; + } - if (count($haipsBeforeOrder) < count($haips)) { - $lastHaip = end($haips); - $this->output($lastHaip); - return 0; - } + $command = $app->get('action:pollstatus'); + + $arguments = [ + 'actionUuid' => $action->getUuid() + ]; - $this->output("Waiting for haip '{$description}', not there yet"); - } - } else { - $this->getTransipApi()->haip()->order($productName, $description); + $actionInput = new ArrayInput($arguments); + $command->run($actionInput, $output); } return 0; } diff --git a/src/Command/PrivateNetwork/AttachVps.php b/src/Command/PrivateNetwork/AttachVps.php index 6d711c0..7cbeb22 100644 --- a/src/Command/PrivateNetwork/AttachVps.php +++ b/src/Command/PrivateNetwork/AttachVps.php @@ -2,11 +2,13 @@ namespace Transip\Api\CLI\Command\PrivateNetwork; +use Transip\Api\CLI\Command\Field; +use Transip\Api\CLI\Command\AbstractCommand; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Transip\Api\CLI\Command\AbstractCommand; -use Transip\Api\CLI\Command\Field; class AttachVps extends AbstractCommand { @@ -15,6 +17,7 @@ protected function configure(): void $this->setName('privatenetwork:attachvps') ->setDescription('Attach a VPS to a private network') ->addArgument(Field::PRIVATENETWORK_NAME, InputArgument::REQUIRED, Field::PRIVATENETWORK_NAME__DESC) + ->addOption(Field::ACTION_WAIT, 'w', InputOption::VALUE_NONE, Field::ACTION_WAIT_DESC) ->addArgument(Field::VPS_NAME, InputArgument::REQUIRED, Field::VPS_NAME__DESC); } @@ -22,8 +25,27 @@ protected function execute(InputInterface $input, OutputInterface $output): int { $privateNetworkName = $input->getArgument(Field::PRIVATENETWORK_NAME); $privateNetworkVpsName = $input->getArgument(Field::VPS_NAME); + $waitForAction = $input->getOption(Field::ACTION_WAIT); + + $response = $this->getTransipApi()->privateNetworks()->attachVps($privateNetworkName, $privateNetworkVpsName); + $action = $this->getTransipApi()->actions()->parseActionFromResponse($response); + + if ($action && $waitForAction) { + $app = $this->getApplication(); + + if (!$app) { + return 0; + } + + $command = $app->get('action:pollstatus'); + + $arguments = [ + 'actionUuid' => $action->getUuid() + ]; - $this->getTransipApi()->privateNetworks()->attachVps($privateNetworkName, $privateNetworkVpsName); + $actionInput = new ArrayInput($arguments); + $command->run($actionInput, $output); + } return 0; } } diff --git a/src/Command/PrivateNetwork/DetachVps.php b/src/Command/PrivateNetwork/DetachVps.php index 309c000..d53430e 100644 --- a/src/Command/PrivateNetwork/DetachVps.php +++ b/src/Command/PrivateNetwork/DetachVps.php @@ -2,11 +2,13 @@ namespace Transip\Api\CLI\Command\PrivateNetwork; +use Transip\Api\CLI\Command\Field; +use Transip\Api\CLI\Command\AbstractCommand; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Transip\Api\CLI\Command\AbstractCommand; -use Transip\Api\CLI\Command\Field; class DetachVps extends AbstractCommand { @@ -15,6 +17,7 @@ protected function configure(): void $this->setName('privatenetwork:detachvps') ->setDescription('Remove a VPS from a private network') ->addArgument(Field::PRIVATENETWORK_NAME, InputArgument::REQUIRED, Field::PRIVATENETWORK_NAME__DESC) + ->addOption(Field::ACTION_WAIT, 'p', InputOption::VALUE_NONE, Field::ACTION_WAIT_DESC) ->addArgument(Field::VPS_NAME, InputArgument::REQUIRED, Field::VPS_NAME__DESC); } @@ -22,8 +25,27 @@ protected function execute(InputInterface $input, OutputInterface $output): int { $privateNetworkName = $input->getArgument(Field::PRIVATENETWORK_NAME); $vpsName = $input->getArgument(Field::VPS_NAME); + $waitForAction = $input->getOption(Field::ACTION_WAIT); + + $response = $this->getTransipApi()->privateNetworks()->detachVps($privateNetworkName, $vpsName); + $action = $this->getTransipApi()->actions()->parseActionFromResponse($response); + + if ($action && $waitForAction) { + $app = $this->getApplication(); + + if (!$app) { + return 0; + } + + $command = $app->get('action:pollstatus'); + + $arguments = [ + 'actionUuid' => $action->getUuid() + ]; - $this->getTransipApi()->privateNetworks()->detachVps($privateNetworkName, $vpsName); + $actionInput = new ArrayInput($arguments); + $command->run($actionInput, $output); + } return 0; } } diff --git a/src/Command/PrivateNetwork/Order.php b/src/Command/PrivateNetwork/Order.php index 82a98d0..169d999 100644 --- a/src/Command/PrivateNetwork/Order.php +++ b/src/Command/PrivateNetwork/Order.php @@ -2,12 +2,13 @@ namespace Transip\Api\CLI\Command\PrivateNetwork; +use Transip\Api\CLI\Command\Field; +use Transip\Api\CLI\Command\AbstractCommand; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Transip\Api\CLI\Command\AbstractCommand; -use Transip\Api\CLI\Command\Field; class Order extends AbstractCommand { @@ -22,27 +23,27 @@ protected function configure(): void protected function execute(InputInterface $input, OutputInterface $output): int { - $description = $input->getArgument(Field::PRIVATENETWORK_DESCRIPTION); + $description = $input->getArgument(Field::PRIVATENETWORK_DESCRIPTION) ?? ''; $shouldWaitForDelivery = $input->getOption(Field::HAIP_WAIT_FOR_DELIVERY); - if ($description && $shouldWaitForDelivery) { - $haipsBeforeOrder = $this->getTransipApi()->privateNetworks()->findByDescription($description); - $this->getTransipApi()->privateNetworks()->order($description); - - while (true) { - sleep(1); - $privateNetworks = $this->getTransipApi()->privateNetworks()->findByDescription($description); + $response = $this->getTransipApi()->privateNetworks()->order($description); + $action = $this->getTransipApi()->actions()->parseActionFromResponse($response); - if (count($haipsBeforeOrder) < count($privateNetworks)) { - $privateNetwork = end($privateNetworks); - $this->output($privateNetwork); - return 0; - } + if ($action && $shouldWaitForDelivery) { + $app = $this->getApplication(); - $this->output("Waiting for private network '{$description}', not there yet"); + if (!$app) { + return 0; } - } else { - $this->getTransipApi()->privateNetworks()->order(); + + $command = $app->get('action:pollstatus'); + + $arguments = [ + 'actionUuid' => $action->getUuid() + ]; + + $actionInput = new ArrayInput($arguments); + $command->run($actionInput, $output); } return 0; } diff --git a/src/Command/Vps/Backup/ConvertToSnapshot.php b/src/Command/Vps/Backup/ConvertToSnapshot.php index a6e793b..174a94f 100644 --- a/src/Command/Vps/Backup/ConvertToSnapshot.php +++ b/src/Command/Vps/Backup/ConvertToSnapshot.php @@ -3,11 +3,13 @@ namespace Transip\Api\CLI\Command\Vps\Backup; +use Transip\Api\CLI\Command\Field; +use Transip\Api\CLI\Command\AbstractCommand; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Transip\Api\CLI\Command\AbstractCommand; -use Transip\Api\CLI\Command\Field; class ConvertToSnapshot extends AbstractCommand { @@ -18,6 +20,8 @@ protected function configure(): void ->addArgument(Field::VPS_NAME, InputArgument::REQUIRED, Field::VPS_NAME__DESC) ->addArgument(Field::VPS_BACKUP_ID, InputArgument::REQUIRED, Field::VPS_BACKUP_ID__DESC) ->addArgument(Field::VPS_SNAPSHOT_DESCRIPTION, InputArgument::OPTIONAL, Field::VPS_SNAPSHOT_DESCRIPTION__DESC . Field::OPTIONAL) + ->addOption(Field::ACTION_WAIT, 'w', InputOption::VALUE_NONE, Field::ACTION_WAIT_DESC) + ->addOption(Field::ACTION_PROGRESS, 'p', InputOption::VALUE_NONE, Field::ACTION_PROGRESS_DESC) ->setHelp('Convert a backup to a snapshot for the VPS. Setting a description for a snapshot is highly recommended in case you have multiple snapshots for one VPS.'); } @@ -26,12 +30,34 @@ protected function execute(InputInterface $input, OutputInterface $output): int $vpsName = $input->getArgument(Field::VPS_NAME); $backupId = $input->getArgument(Field::VPS_BACKUP_ID); $snapshotDescription = $input->getArgument(Field::VPS_SNAPSHOT_DESCRIPTION); + $waitForAction = $input->getOption(Field::ACTION_WAIT); + $showProgress = $input->getOption(Field::ACTION_PROGRESS); if (!$snapshotDescription) { $snapshotDescription = ''; } - $this->getTransipApi()->vpsBackups()->convertBackupToSnapshot($vpsName, $backupId, $snapshotDescription); + $response = $this->getTransipApi()->vpsBackups()->convertBackupToSnapshot($vpsName, $backupId, $snapshotDescription); + $action = $this->getTransipApi()->actions()->parseActionFromResponse($response); + + if ($action && $waitForAction) { + $app = $this->getApplication(); + if (!$app) { + return 0; + } + + $command = $app->get('action:pollstatus'); + $arguments = [ + 'actionUuid' => $action->getUuid() + ]; + + if ($showProgress) { + $arguments['--showProgress'] = true; + } + + $actionInput = new ArrayInput($arguments); + $command->run($actionInput, $output); + } return 0; } } diff --git a/src/Command/Vps/Backup/Revert.php b/src/Command/Vps/Backup/Revert.php index 7b8ea1c..18aafe1 100644 --- a/src/Command/Vps/Backup/Revert.php +++ b/src/Command/Vps/Backup/Revert.php @@ -2,11 +2,13 @@ namespace Transip\Api\CLI\Command\Vps\Backup; +use Transip\Api\CLI\Command\Field; +use Transip\Api\CLI\Command\AbstractCommand; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Transip\Api\CLI\Command\AbstractCommand; -use Transip\Api\CLI\Command\Field; class Revert extends AbstractCommand { @@ -16,6 +18,8 @@ protected function configure(): void ->setDescription('Revert a VPS back-up and restore the VPS to an earlier state') ->addArgument(Field::VPS_NAME, InputArgument::REQUIRED, Field::VPS_NAME__DESC) ->addArgument(Field::VPS_BACKUP_ID, InputArgument::REQUIRED, Field::VPS_BACKUP_ID__DESC) + ->addOption(Field::ACTION_WAIT, 'w', InputOption::VALUE_NONE, Field::ACTION_WAIT_DESC) + ->addOption(Field::ACTION_PROGRESS, 'p', InputOption::VALUE_NONE, Field::ACTION_PROGRESS_DESC) ->setHelp('Reverting a VPS back-up will restore the VPS to an earlier state. Use this API call with care, as data created after the back-up creation date can be wiped when a back-up is restored.'); } @@ -23,8 +27,30 @@ protected function execute(InputInterface $input, OutputInterface $output): int { $vpsName = $input->getArgument(Field::VPS_NAME); $backupId = $input->getArgument(Field::VPS_BACKUP_ID); + $waitForAction = $input->getOption(Field::ACTION_WAIT); + $showProgress = $input->getOption(Field::ACTION_PROGRESS); + + $response = $this->getTransipApi()->vpsBackups()->revertBackup($vpsName, $backupId); + $action = $this->getTransipApi()->actions()->parseActionFromResponse($response); + + if ($action && $waitForAction) { + $app = $this->getApplication(); + if (!$app) { + return 0; + } + + $command = $app->get('action:pollstatus'); + $arguments = [ + 'actionUuid' => $action->getUuid() + ]; - $this->getTransipApi()->vpsBackups()->revertBackup($vpsName, $backupId); + if ($showProgress) { + $arguments['--showProgress'] = true; + } + + $actionInput = new ArrayInput($arguments); + $command->run($actionInput, $output); + } return 0; } } diff --git a/src/Command/Vps/CloneVps.php b/src/Command/Vps/CloneVps.php index 05385b5..4c3e421 100644 --- a/src/Command/Vps/CloneVps.php +++ b/src/Command/Vps/CloneVps.php @@ -2,11 +2,13 @@ namespace Transip\Api\CLI\Command\Vps; +use Transip\Api\CLI\Command\Field; +use Transip\Api\CLI\Command\AbstractCommand; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Transip\Api\CLI\Command\AbstractCommand; -use Transip\Api\CLI\Command\Field; class CloneVps extends AbstractCommand { @@ -16,6 +18,7 @@ protected function configure(): void ->setDescription('Clone an existing VPS') ->addArgument(Field::VPS_NAME, InputArgument::REQUIRED, Field::VPS_NAME__DESC) ->addArgument(Field::AVAILABILITY_ZONE, InputArgument::OPTIONAL, Field::AVAILABILITY_ZONE__DESC . Field::OPTIONAL, '') + ->addOption(Field::ACTION_WAIT, 'w', InputOption::VALUE_NONE, Field::ACTION_WAIT_DESC) ->setHelp('You must provide the vps name of the VPS to clone, and optionally provide the name of the availability zone where the clone should be created'); } @@ -23,8 +26,27 @@ protected function execute(InputInterface $input, OutputInterface $output): int { $vpsName = $input->getArgument(Field::VPS_NAME); $availabilityZone = $input->getArgument(Field::AVAILABILITY_ZONE); + $waitForAction = $input->getOption(Field::ACTION_WAIT); + + $response = $this->getTransipApi()->vps()->cloneVps($vpsName, $availabilityZone); + $action = $this->getTransipApi()->actions()->parseActionFromResponse($response); + + if ($action && $waitForAction) { + $app = $this->getApplication(); + + if (!$app) { + return 0; + } + + $command = $app->get('action:pollstatus'); + + $arguments = [ + 'actionUuid' => $action->getUuid() + ]; - $this->getTransipApi()->vps()->cloneVps($vpsName, $availabilityZone); + $actionInput = new ArrayInput($arguments); + $command->run($actionInput, $output); + } return 0; } } diff --git a/src/Command/Vps/Order.php b/src/Command/Vps/Order.php index 28dd343..31c2737 100644 --- a/src/Command/Vps/Order.php +++ b/src/Command/Vps/Order.php @@ -2,11 +2,13 @@ namespace Transip\Api\CLI\Command\Vps; +use Transip\Api\CLI\Command\Field; +use Transip\Api\CLI\Command\AbstractCommand; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Transip\Api\CLI\Command\AbstractCommand; -use Transip\Api\CLI\Command\Field; class Order extends AbstractCommand { @@ -25,6 +27,7 @@ protected function configure(): void ->addArgument(Field::VPS_SSH_KEYS, InputArgument::OPTIONAL, Field::VPS_SSH_KEYS__DESC . Field::OPTIONAL, '') ->addArgument(Field::VPS_BASE64INSTALLTEXT, InputArgument::OPTIONAL, Field::VPS_BASE64INSTALLTEXT__DESC . Field::OPTIONAL, '') ->addArgument(Field::LICENSE_NAMES, InputArgument::OPTIONAL, Field::LICENSE_NAMES__DESC . Field::OPTIONAL, '') + ->addOption(Field::ACTION_WAIT, 'w', InputOption::VALUE_NONE, Field::ACTION_WAIT_DESC) ->setHelp('Order a Vps with this command. After the order process has been completed (payment will occur at a later stage should direct debit be used) the VPS will automatically be provisioned and deployed. Use Products:getAll to get a list of products'); } @@ -41,12 +44,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int $sshKeys = $input->getArgument(Field::VPS_SSH_KEYS); $base64InstallText = $input->getArgument(Field::VPS_BASE64INSTALLTEXT); $licenseNames = $input->getArgument(Field::LICENSE_NAMES); + $waitForAction = $input->getOption(Field::ACTION_WAIT); $addons = (strlen($addons) > 1) ? explode(',', $addons) : []; $sshKeys = (strlen($sshKeys) > 1) ? explode(',', $sshKeys) : []; $licenseNames = (strlen($licenseNames) > 1) ? explode(',', $licenseNames) : []; - $this->getTransipApi()->vps()->order( + $response = $this->getTransipApi()->vps()->order( $productName, $operatingSystem, $addons, @@ -59,6 +63,25 @@ protected function execute(InputInterface $input, OutputInterface $output): int $sshKeys, $licenseNames ); + + $action = $this->getTransipApi()->actions()->parseActionFromResponse($response); + + if ($action && $waitForAction) { + $app = $this->getApplication(); + + if (!$app) { + return 0; + } + + $command = $app->get('action:pollstatus'); + + $arguments = [ + 'actionUuid' => $action->getUuid() + ]; + + $actionInput = new ArrayInput($arguments); + $command->run($actionInput, $output); + } return 0; } } diff --git a/src/Command/Vps/OrderMultiple.php b/src/Command/Vps/OrderMultiple.php index b6c89bc..fe2851d 100644 --- a/src/Command/Vps/OrderMultiple.php +++ b/src/Command/Vps/OrderMultiple.php @@ -2,11 +2,13 @@ namespace Transip\Api\CLI\Command\Vps; +use Transip\Api\CLI\Command\Field; +use Transip\Api\CLI\Command\AbstractCommand; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Transip\Api\CLI\Command\AbstractCommand; -use Transip\Api\CLI\Command\Field; class OrderMultiple extends AbstractCommand { @@ -25,6 +27,7 @@ protected function configure(): void ->addArgument(Field::VPS_DESCRIPTION, InputArgument::OPTIONAL, Field::VPS_DESCRIPTION__DESC . Field::OPTIONAL, '') ->addArgument(Field::VPS_SSH_KEYS, InputArgument::OPTIONAL, Field::VPS_SSH_KEYS__DESC . Field::OPTIONAL, '') ->addArgument(Field::VPS_BASE64INSTALLTEXT, InputArgument::OPTIONAL, Field::VPS_BASE64INSTALLTEXT__DESC . Field::OPTIONAL, '') + ->addOption(Field::ACTION_WAIT, 'w', InputOption::VALUE_NONE, Field::ACTION_WAIT_DESC) ->setHelp('Order multiple VPSs with this command. After the order process has been completed (payment will occur at a later stage should direct debit be used) the VPS will automatically be provisioned and deployed. Use Products:getAll to get a list of products'); } @@ -41,6 +44,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $username = $input->getArgument(Field::VPS_USERNAME); $sshKeys = $input->getArgument(Field::VPS_SSH_KEYS); $base64InstallText = $input->getArgument(Field::VPS_BASE64INSTALLTEXT); + $waitForAction = $input->getOption(Field::ACTION_WAIT); $addons = (strlen($addons) > 1) ? explode(',', $addons) : []; $sshKeys = (strlen($sshKeys) > 1) ? explode(',', $sshKeys) : []; @@ -62,7 +66,25 @@ protected function execute(InputInterface $input, OutputInterface $output): int ]; } - $this->getTransipApi()->vps()->orderMultiple($vpss); + $response = $this->getTransipApi()->vps()->orderMultiple($vpss); + $action = $this->getTransipApi()->actions()->parseActionFromResponse($response); + + if ($action && $waitForAction) { + $app = $this->getApplication(); + + if (!$app) { + return 0; + } + + $command = $app->get('action:pollstatus'); + + $arguments = [ + 'actionUuid' => $action->getUuid() + ]; + + $actionInput = new ArrayInput($arguments); + $command->run($actionInput, $output); + } return 0; } } diff --git a/src/Command/Vps/Snapshot/Create.php b/src/Command/Vps/Snapshot/Create.php index 5e266c5..08928ca 100644 --- a/src/Command/Vps/Snapshot/Create.php +++ b/src/Command/Vps/Snapshot/Create.php @@ -2,11 +2,13 @@ namespace Transip\Api\CLI\Command\Vps\Snapshot; +use Transip\Api\CLI\Command\Field; +use Transip\Api\CLI\Command\AbstractCommand; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Transip\Api\CLI\Command\AbstractCommand; -use Transip\Api\CLI\Command\Field; class Create extends AbstractCommand { @@ -16,7 +18,9 @@ protected function configure(): void ->setDescription('Create a snapshot for a VPS') ->addArgument(Field::VPS_NAME, InputArgument::REQUIRED, Field::VPS_NAME__DESC) ->addArgument(Field::VPS_SNAPSHOT_DESCRIPTION, InputArgument::REQUIRED, Field::VPS_DESCRIPTION__DESC) - ->addArgument(Field::VPS_SNAPSHOT_SHOULDSTARTVPS, InputArgument::OPTIONAL, Field::VPS_SNAPSHOT_SHOULDSTARTVPS__DESC . Field::OPTIONAL, true); + ->addArgument(Field::VPS_SNAPSHOT_SHOULDSTARTVPS, InputArgument::OPTIONAL, Field::VPS_SNAPSHOT_SHOULDSTARTVPS__DESC . Field::OPTIONAL, true) + ->addOption(Field::ACTION_WAIT, 'w', InputOption::VALUE_NONE, Field::ACTION_WAIT_DESC) + ->addOption(Field::ACTION_PROGRESS, 'p', InputOption::VALUE_NONE, Field::ACTION_PROGRESS_DESC); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -25,8 +29,30 @@ protected function execute(InputInterface $input, OutputInterface $output): int $snapshotDescription = $input->getArgument(Field::VPS_SNAPSHOT_DESCRIPTION); $shouldStartVps = $input->getArgument(Field::VPS_SNAPSHOT_SHOULDSTARTVPS); $shouldStartVps = filter_var($shouldStartVps, FILTER_VALIDATE_BOOLEAN); + $waitForAction = $input->getOption(Field::ACTION_WAIT); + $showProgress = $input->getOption(Field::ACTION_PROGRESS); + + $response = $this->getTransipApi()->vpsSnapshots()->createSnapshot($vpsName, $snapshotDescription, $shouldStartVps); + $action = $this->getTransipApi()->actions()->parseActionFromResponse($response); + + if ($action && $waitForAction) { + $app = $this->getApplication(); + if (!$app) { + return 0; + } + + $command = $app->get('action:pollstatus'); + $arguments = [ + 'actionUuid' => $action->getUuid() + ]; - $this->getTransipApi()->vpsSnapshots()->createSnapshot($vpsName, $snapshotDescription, $shouldStartVps); + if ($showProgress) { + $arguments['--showProgress'] = true; + } + + $actionInput = new ArrayInput($arguments); + $command->run($actionInput, $output); + } return 0; } } diff --git a/src/Command/Vps/Snapshot/Revert.php b/src/Command/Vps/Snapshot/Revert.php index 9d45303..009281e 100644 --- a/src/Command/Vps/Snapshot/Revert.php +++ b/src/Command/Vps/Snapshot/Revert.php @@ -2,11 +2,13 @@ namespace Transip\Api\CLI\Command\Vps\Snapshot; +use Transip\Api\CLI\Command\Field; +use Transip\Api\CLI\Command\AbstractCommand; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Transip\Api\CLI\Command\AbstractCommand; -use Transip\Api\CLI\Command\Field; class Revert extends AbstractCommand { @@ -17,6 +19,8 @@ protected function configure(): void ->addArgument(Field::VPS_NAME, InputArgument::REQUIRED, Field::VPS_NAME__DESC) ->addArgument(Field::VPS_SNAPSHOT_NAME, InputArgument::REQUIRED, Field::VPS_SNAPSHOT_NAME__DESC) ->addArgument(Field::VPS_DESTINATION_VPS_NAME, InputArgument::OPTIONAL, Field::VPS_DESTINATION_VPS_NAME__DESC . Field::OPTIONAL) + ->addOption(Field::ACTION_WAIT, 'w', InputOption::VALUE_NONE, Field::ACTION_WAIT_DESC) + ->addOption(Field::ACTION_PROGRESS, 'p', InputOption::VALUE_NONE, Field::ACTION_PROGRESS_DESC) ->setHelp('When restoring a snapshot, this can be done either on the VPS the snapshot originates from or onto another VPS. Specifying the DestinationVpsName makes sure the snapshot is restored onto another VPS'); } @@ -25,8 +29,30 @@ protected function execute(InputInterface $input, OutputInterface $output): int $vpsName = $input->getArgument(Field::VPS_NAME); $snapshotName = $input->getArgument(Field::VPS_SNAPSHOT_NAME); $destinationVpsName = $input->getArgument(Field::VPS_DESTINATION_VPS_NAME) ?? ''; + $waitForAction = $input->getOption(Field::ACTION_WAIT); + $showProgress = $input->getOption(Field::ACTION_PROGRESS); + + $response = $this->getTransipApi()->vpsSnapshots()->revertSnapshot($vpsName, $snapshotName, $destinationVpsName); + $action = $this->getTransipApi()->actions()->parseActionFromResponse($response); + + if ($action && $waitForAction) { + $app = $this->getApplication(); + if (!$app) { + return 0; + } + + $command = $app->get('action:pollstatus'); + $arguments = [ + 'actionUuid' => $action->getUuid() + ]; - $this->getTransipApi()->vpsSnapshots()->revertSnapshot($vpsName, $snapshotName, $destinationVpsName); + if ($showProgress) { + $arguments['--showProgress'] = true; + } + + $actionInput = new ArrayInput($arguments); + $command->run($actionInput, $output); + } return 0; } } diff --git a/src/Command/Vps/Start.php b/src/Command/Vps/Start.php index 5541e19..bb87c70 100644 --- a/src/Command/Vps/Start.php +++ b/src/Command/Vps/Start.php @@ -2,11 +2,13 @@ namespace Transip\Api\CLI\Command\Vps; +use Transip\Api\CLI\Command\Field; +use Transip\Api\CLI\Command\AbstractCommand; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Transip\Api\CLI\Command\AbstractCommand; -use Transip\Api\CLI\Command\Field; class Start extends AbstractCommand { @@ -15,14 +17,34 @@ protected function configure(): void $this->setName('vps:start') ->setDescription('Start a Vps') ->setHelp('Provide a Vps name to start') - ->addArgument(Field::VPS_NAME, InputArgument::REQUIRED, Field::VPS_NAME__DESC); + ->addArgument(Field::VPS_NAME, InputArgument::REQUIRED, Field::VPS_NAME__DESC) + ->addOption(Field::ACTION_WAIT, 'w', InputOption::VALUE_NONE, Field::ACTION_WAIT_DESC); } protected function execute(InputInterface $input, OutputInterface $output): int { $vpsName = $input->getArgument(Field::VPS_NAME); + $waitForAction = $input->getOption(Field::ACTION_WAIT); + + $response = $this->getTransipApi()->vps()->start($vpsName); + $action = $this->getTransipApi()->actions()->parseActionFromResponse($response); + + if ($action && $waitForAction) { + $app = $this->getApplication(); + + if (!$app) { + return 0; + } + + $command = $app->get('action:pollstatus'); + + $arguments = [ + 'actionUuid' => $action->getUuid() + ]; - $this->getTransipApi()->vps()->start($vpsName); + $actionInput = new ArrayInput($arguments); + $command->run($actionInput, $output); + } return 0; } } diff --git a/src/Settings/Settings.php b/src/Settings/Settings.php index fdf13ab..ce63d54 100644 --- a/src/Settings/Settings.php +++ b/src/Settings/Settings.php @@ -17,7 +17,7 @@ class Settings public const TRANSIP_API_ENDPOINT = 'https://api.transip.nl/v6'; - public const TRANSIP_CLI_VERSION = '6.29.3'; + public const TRANSIP_CLI_VERSION = '6.30.0'; /** * @var string