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