LambdaClient.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <?php
  2. namespace Aws\Lambda;
  3. use Aws\AwsClient;
  4. use Aws\CommandInterface;
  5. use Aws\Middleware;
  6. /**
  7. * This client is used to interact with AWS Lambda
  8. *
  9. * @method \Aws\Result addLayerVersionPermission(array $args = [])
  10. * @method \GuzzleHttp\Promise\Promise addLayerVersionPermissionAsync(array $args = [])
  11. * @method \Aws\Result addPermission(array $args = [])
  12. * @method \GuzzleHttp\Promise\Promise addPermissionAsync(array $args = [])
  13. * @method \Aws\Result createAlias(array $args = [])
  14. * @method \GuzzleHttp\Promise\Promise createAliasAsync(array $args = [])
  15. * @method \Aws\Result createCodeSigningConfig(array $args = [])
  16. * @method \GuzzleHttp\Promise\Promise createCodeSigningConfigAsync(array $args = [])
  17. * @method \Aws\Result createEventSourceMapping(array $args = [])
  18. * @method \GuzzleHttp\Promise\Promise createEventSourceMappingAsync(array $args = [])
  19. * @method \Aws\Result createFunction(array $args = [])
  20. * @method \GuzzleHttp\Promise\Promise createFunctionAsync(array $args = [])
  21. * @method \Aws\Result createFunctionUrlConfig(array $args = [])
  22. * @method \GuzzleHttp\Promise\Promise createFunctionUrlConfigAsync(array $args = [])
  23. * @method \Aws\Result deleteAlias(array $args = [])
  24. * @method \GuzzleHttp\Promise\Promise deleteAliasAsync(array $args = [])
  25. * @method \Aws\Result deleteCodeSigningConfig(array $args = [])
  26. * @method \GuzzleHttp\Promise\Promise deleteCodeSigningConfigAsync(array $args = [])
  27. * @method \Aws\Result deleteEventSourceMapping(array $args = [])
  28. * @method \GuzzleHttp\Promise\Promise deleteEventSourceMappingAsync(array $args = [])
  29. * @method \Aws\Result deleteFunction(array $args = [])
  30. * @method \GuzzleHttp\Promise\Promise deleteFunctionAsync(array $args = [])
  31. * @method \Aws\Result deleteFunctionCodeSigningConfig(array $args = [])
  32. * @method \GuzzleHttp\Promise\Promise deleteFunctionCodeSigningConfigAsync(array $args = [])
  33. * @method \Aws\Result deleteFunctionConcurrency(array $args = [])
  34. * @method \GuzzleHttp\Promise\Promise deleteFunctionConcurrencyAsync(array $args = [])
  35. * @method \Aws\Result deleteFunctionEventInvokeConfig(array $args = [])
  36. * @method \GuzzleHttp\Promise\Promise deleteFunctionEventInvokeConfigAsync(array $args = [])
  37. * @method \Aws\Result deleteFunctionUrlConfig(array $args = [])
  38. * @method \GuzzleHttp\Promise\Promise deleteFunctionUrlConfigAsync(array $args = [])
  39. * @method \Aws\Result deleteLayerVersion(array $args = [])
  40. * @method \GuzzleHttp\Promise\Promise deleteLayerVersionAsync(array $args = [])
  41. * @method \Aws\Result deleteProvisionedConcurrencyConfig(array $args = [])
  42. * @method \GuzzleHttp\Promise\Promise deleteProvisionedConcurrencyConfigAsync(array $args = [])
  43. * @method \Aws\Result getAccountSettings(array $args = [])
  44. * @method \GuzzleHttp\Promise\Promise getAccountSettingsAsync(array $args = [])
  45. * @method \Aws\Result getAlias(array $args = [])
  46. * @method \GuzzleHttp\Promise\Promise getAliasAsync(array $args = [])
  47. * @method \Aws\Result getCodeSigningConfig(array $args = [])
  48. * @method \GuzzleHttp\Promise\Promise getCodeSigningConfigAsync(array $args = [])
  49. * @method \Aws\Result getEventSourceMapping(array $args = [])
  50. * @method \GuzzleHttp\Promise\Promise getEventSourceMappingAsync(array $args = [])
  51. * @method \Aws\Result getFunction(array $args = [])
  52. * @method \GuzzleHttp\Promise\Promise getFunctionAsync(array $args = [])
  53. * @method \Aws\Result getFunctionCodeSigningConfig(array $args = [])
  54. * @method \GuzzleHttp\Promise\Promise getFunctionCodeSigningConfigAsync(array $args = [])
  55. * @method \Aws\Result getFunctionConcurrency(array $args = [])
  56. * @method \GuzzleHttp\Promise\Promise getFunctionConcurrencyAsync(array $args = [])
  57. * @method \Aws\Result getFunctionConfiguration(array $args = [])
  58. * @method \GuzzleHttp\Promise\Promise getFunctionConfigurationAsync(array $args = [])
  59. * @method \Aws\Result getFunctionEventInvokeConfig(array $args = [])
  60. * @method \GuzzleHttp\Promise\Promise getFunctionEventInvokeConfigAsync(array $args = [])
  61. * @method \Aws\Result getFunctionUrlConfig(array $args = [])
  62. * @method \GuzzleHttp\Promise\Promise getFunctionUrlConfigAsync(array $args = [])
  63. * @method \Aws\Result getLayerVersion(array $args = [])
  64. * @method \GuzzleHttp\Promise\Promise getLayerVersionAsync(array $args = [])
  65. * @method \Aws\Result getLayerVersionByArn(array $args = [])
  66. * @method \GuzzleHttp\Promise\Promise getLayerVersionByArnAsync(array $args = [])
  67. * @method \Aws\Result getLayerVersionPolicy(array $args = [])
  68. * @method \GuzzleHttp\Promise\Promise getLayerVersionPolicyAsync(array $args = [])
  69. * @method \Aws\Result getPolicy(array $args = [])
  70. * @method \GuzzleHttp\Promise\Promise getPolicyAsync(array $args = [])
  71. * @method \Aws\Result getProvisionedConcurrencyConfig(array $args = [])
  72. * @method \GuzzleHttp\Promise\Promise getProvisionedConcurrencyConfigAsync(array $args = [])
  73. * @method \Aws\Result getRuntimeManagementConfig(array $args = [])
  74. * @method \GuzzleHttp\Promise\Promise getRuntimeManagementConfigAsync(array $args = [])
  75. * @method \Aws\Result invoke(array $args = [])
  76. * @method \GuzzleHttp\Promise\Promise invokeAsync(array $args = [])
  77. * @method \Aws\Result invokeAsync(array $args = [])
  78. * @method \GuzzleHttp\Promise\Promise invokeAsyncAsync(array $args = [])
  79. * @method \Aws\Result invokeWithResponseStream(array $args = [])
  80. * @method \GuzzleHttp\Promise\Promise invokeWithResponseStreamAsync(array $args = [])
  81. * @method \Aws\Result listAliases(array $args = [])
  82. * @method \GuzzleHttp\Promise\Promise listAliasesAsync(array $args = [])
  83. * @method \Aws\Result listCodeSigningConfigs(array $args = [])
  84. * @method \GuzzleHttp\Promise\Promise listCodeSigningConfigsAsync(array $args = [])
  85. * @method \Aws\Result listEventSourceMappings(array $args = [])
  86. * @method \GuzzleHttp\Promise\Promise listEventSourceMappingsAsync(array $args = [])
  87. * @method \Aws\Result listFunctionEventInvokeConfigs(array $args = [])
  88. * @method \GuzzleHttp\Promise\Promise listFunctionEventInvokeConfigsAsync(array $args = [])
  89. * @method \Aws\Result listFunctionUrlConfigs(array $args = [])
  90. * @method \GuzzleHttp\Promise\Promise listFunctionUrlConfigsAsync(array $args = [])
  91. * @method \Aws\Result listFunctions(array $args = [])
  92. * @method \GuzzleHttp\Promise\Promise listFunctionsAsync(array $args = [])
  93. * @method \Aws\Result listFunctionsByCodeSigningConfig(array $args = [])
  94. * @method \GuzzleHttp\Promise\Promise listFunctionsByCodeSigningConfigAsync(array $args = [])
  95. * @method \Aws\Result listLayerVersions(array $args = [])
  96. * @method \GuzzleHttp\Promise\Promise listLayerVersionsAsync(array $args = [])
  97. * @method \Aws\Result listLayers(array $args = [])
  98. * @method \GuzzleHttp\Promise\Promise listLayersAsync(array $args = [])
  99. * @method \Aws\Result listProvisionedConcurrencyConfigs(array $args = [])
  100. * @method \GuzzleHttp\Promise\Promise listProvisionedConcurrencyConfigsAsync(array $args = [])
  101. * @method \Aws\Result listTags(array $args = [])
  102. * @method \GuzzleHttp\Promise\Promise listTagsAsync(array $args = [])
  103. * @method \Aws\Result listVersionsByFunction(array $args = [])
  104. * @method \GuzzleHttp\Promise\Promise listVersionsByFunctionAsync(array $args = [])
  105. * @method \Aws\Result publishLayerVersion(array $args = [])
  106. * @method \GuzzleHttp\Promise\Promise publishLayerVersionAsync(array $args = [])
  107. * @method \Aws\Result publishVersion(array $args = [])
  108. * @method \GuzzleHttp\Promise\Promise publishVersionAsync(array $args = [])
  109. * @method \Aws\Result putFunctionCodeSigningConfig(array $args = [])
  110. * @method \GuzzleHttp\Promise\Promise putFunctionCodeSigningConfigAsync(array $args = [])
  111. * @method \Aws\Result putFunctionConcurrency(array $args = [])
  112. * @method \GuzzleHttp\Promise\Promise putFunctionConcurrencyAsync(array $args = [])
  113. * @method \Aws\Result putFunctionEventInvokeConfig(array $args = [])
  114. * @method \GuzzleHttp\Promise\Promise putFunctionEventInvokeConfigAsync(array $args = [])
  115. * @method \Aws\Result putProvisionedConcurrencyConfig(array $args = [])
  116. * @method \GuzzleHttp\Promise\Promise putProvisionedConcurrencyConfigAsync(array $args = [])
  117. * @method \Aws\Result putRuntimeManagementConfig(array $args = [])
  118. * @method \GuzzleHttp\Promise\Promise putRuntimeManagementConfigAsync(array $args = [])
  119. * @method \Aws\Result removeLayerVersionPermission(array $args = [])
  120. * @method \GuzzleHttp\Promise\Promise removeLayerVersionPermissionAsync(array $args = [])
  121. * @method \Aws\Result removePermission(array $args = [])
  122. * @method \GuzzleHttp\Promise\Promise removePermissionAsync(array $args = [])
  123. * @method \Aws\Result tagResource(array $args = [])
  124. * @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = [])
  125. * @method \Aws\Result untagResource(array $args = [])
  126. * @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = [])
  127. * @method \Aws\Result updateAlias(array $args = [])
  128. * @method \GuzzleHttp\Promise\Promise updateAliasAsync(array $args = [])
  129. * @method \Aws\Result updateCodeSigningConfig(array $args = [])
  130. * @method \GuzzleHttp\Promise\Promise updateCodeSigningConfigAsync(array $args = [])
  131. * @method \Aws\Result updateEventSourceMapping(array $args = [])
  132. * @method \GuzzleHttp\Promise\Promise updateEventSourceMappingAsync(array $args = [])
  133. * @method \Aws\Result updateFunctionCode(array $args = [])
  134. * @method \GuzzleHttp\Promise\Promise updateFunctionCodeAsync(array $args = [])
  135. * @method \Aws\Result updateFunctionConfiguration(array $args = [])
  136. * @method \GuzzleHttp\Promise\Promise updateFunctionConfigurationAsync(array $args = [])
  137. * @method \Aws\Result updateFunctionEventInvokeConfig(array $args = [])
  138. * @method \GuzzleHttp\Promise\Promise updateFunctionEventInvokeConfigAsync(array $args = [])
  139. * @method \Aws\Result updateFunctionUrlConfig(array $args = [])
  140. * @method \GuzzleHttp\Promise\Promise updateFunctionUrlConfigAsync(array $args = [])
  141. */
  142. class LambdaClient extends AwsClient
  143. {
  144. /**
  145. * {@inheritdoc}
  146. */
  147. public function __construct(array $args)
  148. {
  149. parent::__construct($args);
  150. $list = $this->getHandlerList();
  151. if (extension_loaded('curl')) {
  152. $list->appendInit($this->getDefaultCurlOptionsMiddleware());
  153. }
  154. }
  155. /**
  156. * Provides a middleware that sets default Curl options for the command
  157. *
  158. * @return callable
  159. */
  160. public function getDefaultCurlOptionsMiddleware()
  161. {
  162. return Middleware::mapCommand(function (CommandInterface $cmd) {
  163. $defaultCurlOptions = [
  164. CURLOPT_TCP_KEEPALIVE => 1,
  165. ];
  166. if (!isset($cmd['@http']['curl'])) {
  167. $cmd['@http']['curl'] = $defaultCurlOptions;
  168. } else {
  169. $cmd['@http']['curl'] += $defaultCurlOptions;
  170. }
  171. return $cmd;
  172. });
  173. }
  174. }