Skip to content

Commit b152abc

Browse files
authored
[Lambda] Add getFunctionConfiguration and updateFunctionConfiguration (#1556)
* [Lambda] Add getFunctionConfiguration and updateFunctionConfiguration * [Lambda] Update changelog
1 parent 0b579e4 commit b152abc

21 files changed

+2584
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## NOT RELEASED
44

5+
### Added
6+
7+
- Added operation `getFunctionConfiguration` and `updateFunctionConfiguration`.
8+
59
### Changed
610

711
- Allow passing explicit null values for optional fields of input objects
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace AsyncAws\Lambda\Exception;
4+
5+
use AsyncAws\Core\Exception\Http\ClientException;
6+
use Symfony\Contracts\HttpClient\ResponseInterface;
7+
8+
/**
9+
* The specified code signing configuration does not exist.
10+
*/
11+
final class CodeSigningConfigNotFoundException extends ClientException
12+
{
13+
/**
14+
* @var string|null
15+
*/
16+
private $type;
17+
18+
public function getType(): ?string
19+
{
20+
return $this->type;
21+
}
22+
23+
protected function populateResult(ResponseInterface $response): void
24+
{
25+
$data = $response->toArray(false);
26+
27+
$this->type = isset($data['Type']) ? (string) $data['Type'] : null;
28+
}
29+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace AsyncAws\Lambda\Exception;
4+
5+
use AsyncAws\Core\Exception\Http\ClientException;
6+
use Symfony\Contracts\HttpClient\ResponseInterface;
7+
8+
/**
9+
* The code signature failed one or more of the validation checks for signature mismatch or expiry, and the code signing
10+
* policy is set to ENFORCE. Lambda blocks the deployment.
11+
*/
12+
final class CodeVerificationFailedException extends ClientException
13+
{
14+
/**
15+
* @var string|null
16+
*/
17+
private $type;
18+
19+
public function getType(): ?string
20+
{
21+
return $this->type;
22+
}
23+
24+
protected function populateResult(ResponseInterface $response): void
25+
{
26+
$data = $response->toArray(false);
27+
28+
$this->type = isset($data['Type']) ? (string) $data['Type'] : null;
29+
}
30+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace AsyncAws\Lambda\Exception;
4+
5+
use AsyncAws\Core\Exception\Http\ClientException;
6+
use Symfony\Contracts\HttpClient\ResponseInterface;
7+
8+
/**
9+
* The code signature failed the integrity check. If the integrity check fails, then Lambda blocks deployment, even if
10+
* the code signing policy is set to WARN.
11+
*/
12+
final class InvalidCodeSignatureException extends ClientException
13+
{
14+
/**
15+
* @var string|null
16+
*/
17+
private $type;
18+
19+
public function getType(): ?string
20+
{
21+
return $this->type;
22+
}
23+
24+
protected function populateResult(ResponseInterface $response): void
25+
{
26+
$data = $response->toArray(false);
27+
28+
$this->type = isset($data['Type']) ? (string) $data['Type'] : null;
29+
}
30+
}
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<?php
2+
3+
namespace AsyncAws\Lambda\Input;
4+
5+
use AsyncAws\Core\Exception\InvalidArgument;
6+
use AsyncAws\Core\Input;
7+
use AsyncAws\Core\Request;
8+
use AsyncAws\Core\Stream\StreamFactory;
9+
10+
final class GetFunctionConfigurationRequest extends Input
11+
{
12+
/**
13+
* The name of the Lambda function, version, or alias.
14+
*
15+
* **Name formats**
16+
*
17+
* - **Function name** – `my-function` (name-only), `my-function:v1` (with alias).
18+
* - **Function ARN** – `arn:aws:lambda:us-west-2:123456789012:function:my-function`.
19+
* - **Partial ARN** – `123456789012:function:my-function`.
20+
*
21+
* You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN.
22+
* If you specify only the function name, it is limited to 64 characters in length.
23+
*
24+
* @required
25+
*
26+
* @var string|null
27+
*/
28+
private $functionName;
29+
30+
/**
31+
* Specify a version or alias to get details about a published version of the function.
32+
*
33+
* @var string|null
34+
*/
35+
private $qualifier;
36+
37+
/**
38+
* @param array{
39+
* FunctionName?: string,
40+
* Qualifier?: null|string,
41+
* '@region'?: string|null,
42+
* } $input
43+
*/
44+
public function __construct(array $input = [])
45+
{
46+
$this->functionName = $input['FunctionName'] ?? null;
47+
$this->qualifier = $input['Qualifier'] ?? null;
48+
parent::__construct($input);
49+
}
50+
51+
/**
52+
* @param array{
53+
* FunctionName?: string,
54+
* Qualifier?: null|string,
55+
* '@region'?: string|null,
56+
* }|GetFunctionConfigurationRequest $input
57+
*/
58+
public static function create($input): self
59+
{
60+
return $input instanceof self ? $input : new self($input);
61+
}
62+
63+
public function getFunctionName(): ?string
64+
{
65+
return $this->functionName;
66+
}
67+
68+
public function getQualifier(): ?string
69+
{
70+
return $this->qualifier;
71+
}
72+
73+
/**
74+
* @internal
75+
*/
76+
public function request(): Request
77+
{
78+
// Prepare headers
79+
$headers = ['content-type' => 'application/json'];
80+
81+
// Prepare query
82+
$query = [];
83+
if (null !== $this->qualifier) {
84+
$query['Qualifier'] = $this->qualifier;
85+
}
86+
87+
// Prepare URI
88+
$uri = [];
89+
if (null === $v = $this->functionName) {
90+
throw new InvalidArgument(sprintf('Missing parameter "FunctionName" for "%s". The value cannot be null.', __CLASS__));
91+
}
92+
$uri['FunctionName'] = $v;
93+
$uriString = '/2015-03-31/functions/' . rawurlencode($uri['FunctionName']) . '/configuration';
94+
95+
// Prepare Body
96+
$body = '';
97+
98+
// Return the Request
99+
return new Request('GET', $uriString, $query, $headers, StreamFactory::create($body));
100+
}
101+
102+
public function setFunctionName(?string $value): self
103+
{
104+
$this->functionName = $value;
105+
106+
return $this;
107+
}
108+
109+
public function setQualifier(?string $value): self
110+
{
111+
$this->qualifier = $value;
112+
113+
return $this;
114+
}
115+
}

0 commit comments

Comments
 (0)