Skip to content

Commit a5212c7

Browse files
Update generated code (#1991)
* update generated code * Apply suggestion from @jderusse --------- Co-authored-by: Jérémy Derussé <[email protected]>
1 parent 228fcb4 commit a5212c7

File tree

5 files changed

+79
-0
lines changed

5 files changed

+79
-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+
- AWS api-change: Amazon Bedrock Runtime Service Tier Support Launch
8+
59
### Dependency bumped
610

711
- Drop support for PHP versions lower than 8.2

src/BedrockRuntimeClient.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace AsyncAws\BedrockRuntime;
44

55
use AsyncAws\BedrockRuntime\Enum\PerformanceConfigLatency;
6+
use AsyncAws\BedrockRuntime\Enum\ServiceTierType;
67
use AsyncAws\BedrockRuntime\Enum\Trace;
78
use AsyncAws\BedrockRuntime\Exception\AccessDeniedException;
89
use AsyncAws\BedrockRuntime\Exception\InternalServerException;
@@ -57,6 +58,7 @@ class BedrockRuntimeClient extends AbstractApi
5758
* guardrailIdentifier?: string|null,
5859
* guardrailVersion?: string|null,
5960
* performanceConfigLatency?: PerformanceConfigLatency::*|null,
61+
* serviceTier?: ServiceTierType::*|null,
6062
* '@region'?: string|null,
6163
* }|InvokeModelRequest $input
6264
*

src/Enum/ServiceTierType.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace AsyncAws\BedrockRuntime\Enum;
4+
5+
final class ServiceTierType
6+
{
7+
public const DEFAULT = 'default';
8+
public const FLEX = 'flex';
9+
public const PRIORITY = 'priority';
10+
11+
public static function exists(string $value): bool
12+
{
13+
return isset([
14+
self::DEFAULT => true,
15+
self::FLEX => true,
16+
self::PRIORITY => true,
17+
][$value]);
18+
}
19+
}

src/Input/InvokeModelRequest.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace AsyncAws\BedrockRuntime\Input;
44

55
use AsyncAws\BedrockRuntime\Enum\PerformanceConfigLatency;
6+
use AsyncAws\BedrockRuntime\Enum\ServiceTierType;
67
use AsyncAws\BedrockRuntime\Enum\Trace;
78
use AsyncAws\Core\Exception\InvalidArgument;
89
use AsyncAws\Core\Input;
@@ -103,6 +104,13 @@ final class InvokeModelRequest extends Input
103104
*/
104105
private $performanceConfigLatency;
105106

107+
/**
108+
* Specifies the processing tier type used for serving the request.
109+
*
110+
* @var ServiceTierType::*|null
111+
*/
112+
private $serviceTier;
113+
106114
/**
107115
* @param array{
108116
* body?: string|null,
@@ -113,6 +121,7 @@ final class InvokeModelRequest extends Input
113121
* guardrailIdentifier?: string|null,
114122
* guardrailVersion?: string|null,
115123
* performanceConfigLatency?: PerformanceConfigLatency::*|null,
124+
* serviceTier?: ServiceTierType::*|null,
116125
* '@region'?: string|null,
117126
* } $input
118127
*/
@@ -126,6 +135,7 @@ public function __construct(array $input = [])
126135
$this->guardrailIdentifier = $input['guardrailIdentifier'] ?? null;
127136
$this->guardrailVersion = $input['guardrailVersion'] ?? null;
128137
$this->performanceConfigLatency = $input['performanceConfigLatency'] ?? null;
138+
$this->serviceTier = $input['serviceTier'] ?? null;
129139
parent::__construct($input);
130140
}
131141

@@ -139,6 +149,7 @@ public function __construct(array $input = [])
139149
* guardrailIdentifier?: string|null,
140150
* guardrailVersion?: string|null,
141151
* performanceConfigLatency?: PerformanceConfigLatency::*|null,
152+
* serviceTier?: ServiceTierType::*|null,
142153
* '@region'?: string|null,
143154
* }|InvokeModelRequest $input
144155
*/
@@ -185,6 +196,14 @@ public function getPerformanceConfigLatency(): ?string
185196
return $this->performanceConfigLatency;
186197
}
187198

199+
/**
200+
* @return ServiceTierType::*|null
201+
*/
202+
public function getServiceTier(): ?string
203+
{
204+
return $this->serviceTier;
205+
}
206+
188207
/**
189208
* @return Trace::*|null
190209
*/
@@ -227,6 +246,12 @@ public function request(): Request
227246
}
228247
$headers['X-Amzn-Bedrock-PerformanceConfig-Latency'] = $this->performanceConfigLatency;
229248
}
249+
if (null !== $this->serviceTier) {
250+
if (!ServiceTierType::exists($this->serviceTier)) {
251+
throw new InvalidArgument(\sprintf('Invalid parameter "serviceTier" for "%s". The value "%s" is not a valid "ServiceTierType".', __CLASS__, $this->serviceTier));
252+
}
253+
$headers['X-Amzn-Bedrock-Service-Tier'] = $this->serviceTier;
254+
}
230255

231256
// Prepare query
232257
$query = [];
@@ -298,6 +323,16 @@ public function setPerformanceConfigLatency(?string $value): self
298323
return $this;
299324
}
300325

326+
/**
327+
* @param ServiceTierType::*|null $value
328+
*/
329+
public function setServiceTier(?string $value): self
330+
{
331+
$this->serviceTier = $value;
332+
333+
return $this;
334+
}
335+
301336
/**
302337
* @param Trace::*|null $value
303338
*/

src/Result/InvokeModelResponse.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace AsyncAws\BedrockRuntime\Result;
44

55
use AsyncAws\BedrockRuntime\Enum\PerformanceConfigLatency;
6+
use AsyncAws\BedrockRuntime\Enum\ServiceTierType;
67
use AsyncAws\Core\Response;
78
use AsyncAws\Core\Result;
89

@@ -32,6 +33,13 @@ class InvokeModelResponse extends Result
3233
*/
3334
private $performanceConfigLatency;
3435

36+
/**
37+
* Specifies the processing tier type used for serving the request.
38+
*
39+
* @var ServiceTierType::*|null
40+
*/
41+
private $serviceTier;
42+
3543
public function getBody(): string
3644
{
3745
$this->initialize();
@@ -56,12 +64,23 @@ public function getPerformanceConfigLatency(): ?string
5664
return $this->performanceConfigLatency;
5765
}
5866

67+
/**
68+
* @return ServiceTierType::*|null
69+
*/
70+
public function getServiceTier(): ?string
71+
{
72+
$this->initialize();
73+
74+
return $this->serviceTier;
75+
}
76+
5977
protected function populateResult(Response $response): void
6078
{
6179
$headers = $response->getHeaders();
6280

6381
$this->contentType = $headers['content-type'][0];
6482
$this->performanceConfigLatency = $headers['x-amzn-bedrock-performanceconfig-latency'][0] ?? null;
83+
$this->serviceTier = $headers['x-amzn-bedrock-service-tier'][0] ?? null;
6584

6685
$this->body = $response->getContent();
6786
}

0 commit comments

Comments
 (0)