/libraries/fabrik/vendor/aws/aws-sdk-php/src/Lambda/LambdaClient.php

https://github.com/trob/fabrik · PHP · 161 lines · 30 code · 3 blank · 128 comment · 3 complexity · 8fd18f48861096925f3129b0ff4ebb94 MD5 · raw file

  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 deleteAlias(array $args = [])
  22. * @method \GuzzleHttp\Promise\Promise deleteAliasAsync(array $args = [])
  23. * @method \Aws\Result deleteCodeSigningConfig(array $args = [])
  24. * @method \GuzzleHttp\Promise\Promise deleteCodeSigningConfigAsync(array $args = [])
  25. * @method \Aws\Result deleteEventSourceMapping(array $args = [])
  26. * @method \GuzzleHttp\Promise\Promise deleteEventSourceMappingAsync(array $args = [])
  27. * @method \Aws\Result deleteFunction(array $args = [])
  28. * @method \GuzzleHttp\Promise\Promise deleteFunctionAsync(array $args = [])
  29. * @method \Aws\Result deleteFunctionCodeSigningConfig(array $args = [])
  30. * @method \GuzzleHttp\Promise\Promise deleteFunctionCodeSigningConfigAsync(array $args = [])
  31. * @method \Aws\Result deleteFunctionConcurrency(array $args = [])
  32. * @method \GuzzleHttp\Promise\Promise deleteFunctionConcurrencyAsync(array $args = [])
  33. * @method \Aws\Result deleteFunctionEventInvokeConfig(array $args = [])
  34. * @method \GuzzleHttp\Promise\Promise deleteFunctionEventInvokeConfigAsync(array $args = [])
  35. * @method \Aws\Result deleteLayerVersion(array $args = [])
  36. * @method \GuzzleHttp\Promise\Promise deleteLayerVersionAsync(array $args = [])
  37. * @method \Aws\Result deleteProvisionedConcurrencyConfig(array $args = [])
  38. * @method \GuzzleHttp\Promise\Promise deleteProvisionedConcurrencyConfigAsync(array $args = [])
  39. * @method \Aws\Result getAccountSettings(array $args = [])
  40. * @method \GuzzleHttp\Promise\Promise getAccountSettingsAsync(array $args = [])
  41. * @method \Aws\Result getAlias(array $args = [])
  42. * @method \GuzzleHttp\Promise\Promise getAliasAsync(array $args = [])
  43. * @method \Aws\Result getCodeSigningConfig(array $args = [])
  44. * @method \GuzzleHttp\Promise\Promise getCodeSigningConfigAsync(array $args = [])
  45. * @method \Aws\Result getEventSourceMapping(array $args = [])
  46. * @method \GuzzleHttp\Promise\Promise getEventSourceMappingAsync(array $args = [])
  47. * @method \Aws\Result getFunction(array $args = [])
  48. * @method \GuzzleHttp\Promise\Promise getFunctionAsync(array $args = [])
  49. * @method \Aws\Result getFunctionCodeSigningConfig(array $args = [])
  50. * @method \GuzzleHttp\Promise\Promise getFunctionCodeSigningConfigAsync(array $args = [])
  51. * @method \Aws\Result getFunctionConcurrency(array $args = [])
  52. * @method \GuzzleHttp\Promise\Promise getFunctionConcurrencyAsync(array $args = [])
  53. * @method \Aws\Result getFunctionConfiguration(array $args = [])
  54. * @method \GuzzleHttp\Promise\Promise getFunctionConfigurationAsync(array $args = [])
  55. * @method \Aws\Result getFunctionEventInvokeConfig(array $args = [])
  56. * @method \GuzzleHttp\Promise\Promise getFunctionEventInvokeConfigAsync(array $args = [])
  57. * @method \Aws\Result getLayerVersion(array $args = [])
  58. * @method \GuzzleHttp\Promise\Promise getLayerVersionAsync(array $args = [])
  59. * @method \Aws\Result getLayerVersionByArn(array $args = [])
  60. * @method \GuzzleHttp\Promise\Promise getLayerVersionByArnAsync(array $args = [])
  61. * @method \Aws\Result getLayerVersionPolicy(array $args = [])
  62. * @method \GuzzleHttp\Promise\Promise getLayerVersionPolicyAsync(array $args = [])
  63. * @method \Aws\Result getPolicy(array $args = [])
  64. * @method \GuzzleHttp\Promise\Promise getPolicyAsync(array $args = [])
  65. * @method \Aws\Result getProvisionedConcurrencyConfig(array $args = [])
  66. * @method \GuzzleHttp\Promise\Promise getProvisionedConcurrencyConfigAsync(array $args = [])
  67. * @method \Aws\Result invoke(array $args = [])
  68. * @method \GuzzleHttp\Promise\Promise invokeAsync(array $args = [])
  69. * @method \Aws\Result invokeAsync(array $args = [])
  70. * @method \GuzzleHttp\Promise\Promise invokeAsyncAsync(array $args = [])
  71. * @method \Aws\Result listAliases(array $args = [])
  72. * @method \GuzzleHttp\Promise\Promise listAliasesAsync(array $args = [])
  73. * @method \Aws\Result listCodeSigningConfigs(array $args = [])
  74. * @method \GuzzleHttp\Promise\Promise listCodeSigningConfigsAsync(array $args = [])
  75. * @method \Aws\Result listEventSourceMappings(array $args = [])
  76. * @method \GuzzleHttp\Promise\Promise listEventSourceMappingsAsync(array $args = [])
  77. * @method \Aws\Result listFunctionEventInvokeConfigs(array $args = [])
  78. * @method \GuzzleHttp\Promise\Promise listFunctionEventInvokeConfigsAsync(array $args = [])
  79. * @method \Aws\Result listFunctions(array $args = [])
  80. * @method \GuzzleHttp\Promise\Promise listFunctionsAsync(array $args = [])
  81. * @method \Aws\Result listFunctionsByCodeSigningConfig(array $args = [])
  82. * @method \GuzzleHttp\Promise\Promise listFunctionsByCodeSigningConfigAsync(array $args = [])
  83. * @method \Aws\Result listLayerVersions(array $args = [])
  84. * @method \GuzzleHttp\Promise\Promise listLayerVersionsAsync(array $args = [])
  85. * @method \Aws\Result listLayers(array $args = [])
  86. * @method \GuzzleHttp\Promise\Promise listLayersAsync(array $args = [])
  87. * @method \Aws\Result listProvisionedConcurrencyConfigs(array $args = [])
  88. * @method \GuzzleHttp\Promise\Promise listProvisionedConcurrencyConfigsAsync(array $args = [])
  89. * @method \Aws\Result listTags(array $args = [])
  90. * @method \GuzzleHttp\Promise\Promise listTagsAsync(array $args = [])
  91. * @method \Aws\Result listVersionsByFunction(array $args = [])
  92. * @method \GuzzleHttp\Promise\Promise listVersionsByFunctionAsync(array $args = [])
  93. * @method \Aws\Result publishLayerVersion(array $args = [])
  94. * @method \GuzzleHttp\Promise\Promise publishLayerVersionAsync(array $args = [])
  95. * @method \Aws\Result publishVersion(array $args = [])
  96. * @method \GuzzleHttp\Promise\Promise publishVersionAsync(array $args = [])
  97. * @method \Aws\Result putFunctionCodeSigningConfig(array $args = [])
  98. * @method \GuzzleHttp\Promise\Promise putFunctionCodeSigningConfigAsync(array $args = [])
  99. * @method \Aws\Result putFunctionConcurrency(array $args = [])
  100. * @method \GuzzleHttp\Promise\Promise putFunctionConcurrencyAsync(array $args = [])
  101. * @method \Aws\Result putFunctionEventInvokeConfig(array $args = [])
  102. * @method \GuzzleHttp\Promise\Promise putFunctionEventInvokeConfigAsync(array $args = [])
  103. * @method \Aws\Result putProvisionedConcurrencyConfig(array $args = [])
  104. * @method \GuzzleHttp\Promise\Promise putProvisionedConcurrencyConfigAsync(array $args = [])
  105. * @method \Aws\Result removeLayerVersionPermission(array $args = [])
  106. * @method \GuzzleHttp\Promise\Promise removeLayerVersionPermissionAsync(array $args = [])
  107. * @method \Aws\Result removePermission(array $args = [])
  108. * @method \GuzzleHttp\Promise\Promise removePermissionAsync(array $args = [])
  109. * @method \Aws\Result tagResource(array $args = [])
  110. * @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = [])
  111. * @method \Aws\Result untagResource(array $args = [])
  112. * @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = [])
  113. * @method \Aws\Result updateAlias(array $args = [])
  114. * @method \GuzzleHttp\Promise\Promise updateAliasAsync(array $args = [])
  115. * @method \Aws\Result updateCodeSigningConfig(array $args = [])
  116. * @method \GuzzleHttp\Promise\Promise updateCodeSigningConfigAsync(array $args = [])
  117. * @method \Aws\Result updateEventSourceMapping(array $args = [])
  118. * @method \GuzzleHttp\Promise\Promise updateEventSourceMappingAsync(array $args = [])
  119. * @method \Aws\Result updateFunctionCode(array $args = [])
  120. * @method \GuzzleHttp\Promise\Promise updateFunctionCodeAsync(array $args = [])
  121. * @method \Aws\Result updateFunctionConfiguration(array $args = [])
  122. * @method \GuzzleHttp\Promise\Promise updateFunctionConfigurationAsync(array $args = [])
  123. * @method \Aws\Result updateFunctionEventInvokeConfig(array $args = [])
  124. * @method \GuzzleHttp\Promise\Promise updateFunctionEventInvokeConfigAsync(array $args = [])
  125. */
  126. class LambdaClient extends AwsClient
  127. {
  128. /**
  129. * {@inheritdoc}
  130. */
  131. public function __construct(array $args)
  132. {
  133. parent::__construct($args);
  134. $list = $this->getHandlerList();
  135. if (extension_loaded('curl')) {
  136. $list->appendInit($this->getDefaultCurlOptionsMiddleware());
  137. }
  138. }
  139. /**
  140. * Provides a middleware that sets default Curl options for the command
  141. *
  142. * @return callable
  143. */
  144. public function getDefaultCurlOptionsMiddleware()
  145. {
  146. return Middleware::mapCommand(function (CommandInterface $cmd) {
  147. $defaultCurlOptions = [
  148. CURLOPT_TCP_KEEPALIVE => 1,
  149. ];
  150. if (!isset($cmd['@http']['curl'])) {
  151. $cmd['@http']['curl'] = $defaultCurlOptions;
  152. } else {
  153. $cmd['@http']['curl'] += $defaultCurlOptions;
  154. }
  155. return $cmd;
  156. });
  157. }
  158. }