77use AsyncAws \Core \Request ;
88use AsyncAws \Core \Stream \StreamFactory ;
99use AsyncAws \DynamoDb \Enum \BillingMode ;
10+ use AsyncAws \DynamoDb \Enum \GlobalTableSettingsReplicationMode ;
1011use AsyncAws \DynamoDb \Enum \TableClass ;
1112use AsyncAws \DynamoDb \ValueObject \AttributeDefinition ;
1213use AsyncAws \DynamoDb \ValueObject \GlobalSecondaryIndex ;
@@ -27,8 +28,6 @@ final class CreateTableInput extends Input
2728 /**
2829 * An array of attributes that describe the key schema for the table and indexes.
2930 *
30- * @required
31- *
3231 * @var AttributeDefinition[]|null
3332 */
3433 private $ attributeDefinitions ;
@@ -73,8 +72,6 @@ final class CreateTableInput extends Input
7372 * [^1]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataModel.html
7473 * [^2]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.html#WorkingWithTables.primary.key
7574 *
76- * @required
77- *
7875 * @var KeySchemaElement[]|null
7976 */
8077 private $ keySchema ;
@@ -116,7 +113,8 @@ final class CreateTableInput extends Input
116113 * the array includes the following:
117114 *
118115 * - `IndexName` - The name of the global secondary index. Must be unique only for this table.
119- * - `KeySchema` - Specifies the key schema for the global secondary index.
116+ * - `KeySchema` - Specifies the key schema for the global secondary index. Each global secondary index supports up to 4
117+ * partition keys and up to 4 sort keys.
120118 * - `Projection` - Specifies attributes that are copied (projected) from the table into the index. These are in
121119 * addition to the primary key attributes and index key attributes, which are automatically projected. Each attribute
122120 * specification is composed of:
@@ -253,11 +251,27 @@ final class CreateTableInput extends Input
253251 */
254252 private $ onDemandThroughput ;
255253
254+ /**
255+ * The Amazon Resource Name (ARN) of the source table used for the creation of a multi-account global table.
256+ *
257+ * @var string|null
258+ */
259+ private $ globalTableSourceArn ;
260+
261+ /**
262+ * Controls the settings synchronization mode for the global table. For multi-account global tables, this parameter is
263+ * required and the only supported value is ENABLED. For same-account global tables, this parameter is set to
264+ * ENABLED_WITH_OVERRIDES.
265+ *
266+ * @var GlobalTableSettingsReplicationMode::*|null
267+ */
268+ private $ globalTableSettingsReplicationMode ;
269+
256270 /**
257271 * @param array{
258- * AttributeDefinitions?: array<AttributeDefinition|array>,
272+ * AttributeDefinitions?: array<AttributeDefinition|array>|null ,
259273 * TableName?: string,
260- * KeySchema?: array<KeySchemaElement|array>,
274+ * KeySchema?: array<KeySchemaElement|array>|null ,
261275 * LocalSecondaryIndexes?: array<LocalSecondaryIndex|array>|null,
262276 * GlobalSecondaryIndexes?: array<GlobalSecondaryIndex|array>|null,
263277 * BillingMode?: BillingMode::*|null,
@@ -270,6 +284,8 @@ final class CreateTableInput extends Input
270284 * WarmThroughput?: WarmThroughput|array|null,
271285 * ResourcePolicy?: string|null,
272286 * OnDemandThroughput?: OnDemandThroughput|array|null,
287+ * GlobalTableSourceArn?: string|null,
288+ * GlobalTableSettingsReplicationMode?: GlobalTableSettingsReplicationMode::*|null,
273289 * '@region'?: string|null,
274290 * } $input
275291 */
@@ -290,14 +306,16 @@ public function __construct(array $input = [])
290306 $ this ->warmThroughput = isset ($ input ['WarmThroughput ' ]) ? WarmThroughput::create ($ input ['WarmThroughput ' ]) : null ;
291307 $ this ->resourcePolicy = $ input ['ResourcePolicy ' ] ?? null ;
292308 $ this ->onDemandThroughput = isset ($ input ['OnDemandThroughput ' ]) ? OnDemandThroughput::create ($ input ['OnDemandThroughput ' ]) : null ;
309+ $ this ->globalTableSourceArn = $ input ['GlobalTableSourceArn ' ] ?? null ;
310+ $ this ->globalTableSettingsReplicationMode = $ input ['GlobalTableSettingsReplicationMode ' ] ?? null ;
293311 parent ::__construct ($ input );
294312 }
295313
296314 /**
297315 * @param array{
298- * AttributeDefinitions?: array<AttributeDefinition|array>,
316+ * AttributeDefinitions?: array<AttributeDefinition|array>|null ,
299317 * TableName?: string,
300- * KeySchema?: array<KeySchemaElement|array>,
318+ * KeySchema?: array<KeySchemaElement|array>|null ,
301319 * LocalSecondaryIndexes?: array<LocalSecondaryIndex|array>|null,
302320 * GlobalSecondaryIndexes?: array<GlobalSecondaryIndex|array>|null,
303321 * BillingMode?: BillingMode::*|null,
@@ -310,6 +328,8 @@ public function __construct(array $input = [])
310328 * WarmThroughput?: WarmThroughput|array|null,
311329 * ResourcePolicy?: string|null,
312330 * OnDemandThroughput?: OnDemandThroughput|array|null,
331+ * GlobalTableSourceArn?: string|null,
332+ * GlobalTableSettingsReplicationMode?: GlobalTableSettingsReplicationMode::*|null,
313333 * '@region'?: string|null,
314334 * }|CreateTableInput $input
315335 */
@@ -347,6 +367,19 @@ public function getGlobalSecondaryIndexes(): array
347367 return $ this ->globalSecondaryIndexes ?? [];
348368 }
349369
370+ /**
371+ * @return GlobalTableSettingsReplicationMode::*|null
372+ */
373+ public function getGlobalTableSettingsReplicationMode (): ?string
374+ {
375+ return $ this ->globalTableSettingsReplicationMode ;
376+ }
377+
378+ public function getGlobalTableSourceArn (): ?string
379+ {
380+ return $ this ->globalTableSourceArn ;
381+ }
382+
350383 /**
351384 * @return KeySchemaElement[]
352385 */
@@ -477,6 +510,23 @@ public function setGlobalSecondaryIndexes(array $value): self
477510 return $ this ;
478511 }
479512
513+ /**
514+ * @param GlobalTableSettingsReplicationMode::*|null $value
515+ */
516+ public function setGlobalTableSettingsReplicationMode (?string $ value ): self
517+ {
518+ $ this ->globalTableSettingsReplicationMode = $ value ;
519+
520+ return $ this ;
521+ }
522+
523+ public function setGlobalTableSourceArn (?string $ value ): self
524+ {
525+ $ this ->globalTableSourceArn = $ value ;
526+
527+ return $ this ;
528+ }
529+
480530 /**
481531 * @param KeySchemaElement[] $value
482532 */
@@ -569,32 +619,26 @@ public function setWarmThroughput(?WarmThroughput $value): self
569619 private function requestBody (): array
570620 {
571621 $ payload = [];
572- if (null === $ v = $ this ->attributeDefinitions ) {
573- throw new InvalidArgument (\sprintf ('Missing parameter "AttributeDefinitions" for "%s". The value cannot be null. ' , __CLASS__ ));
574- }
575-
576- $ index = -1 ;
577- $ payload ['AttributeDefinitions ' ] = [];
578- foreach ($ v as $ listValue ) {
579- ++$ index ;
580- $ payload ['AttributeDefinitions ' ][$ index ] = $ listValue ->requestBody ();
622+ if (null !== $ v = $ this ->attributeDefinitions ) {
623+ $ index = -1 ;
624+ $ payload ['AttributeDefinitions ' ] = [];
625+ foreach ($ v as $ listValue ) {
626+ ++$ index ;
627+ $ payload ['AttributeDefinitions ' ][$ index ] = $ listValue ->requestBody ();
628+ }
581629 }
582-
583630 if (null === $ v = $ this ->tableName ) {
584631 throw new InvalidArgument (\sprintf ('Missing parameter "TableName" for "%s". The value cannot be null. ' , __CLASS__ ));
585632 }
586633 $ payload ['TableName ' ] = $ v ;
587- if (null === $ v = $ this ->keySchema ) {
588- throw new InvalidArgument (\sprintf ('Missing parameter "KeySchema" for "%s". The value cannot be null. ' , __CLASS__ ));
589- }
590-
591- $ index = -1 ;
592- $ payload ['KeySchema ' ] = [];
593- foreach ($ v as $ listValue ) {
594- ++$ index ;
595- $ payload ['KeySchema ' ][$ index ] = $ listValue ->requestBody ();
634+ if (null !== $ v = $ this ->keySchema ) {
635+ $ index = -1 ;
636+ $ payload ['KeySchema ' ] = [];
637+ foreach ($ v as $ listValue ) {
638+ ++$ index ;
639+ $ payload ['KeySchema ' ][$ index ] = $ listValue ->requestBody ();
640+ }
596641 }
597-
598642 if (null !== $ v = $ this ->localSecondaryIndexes ) {
599643 $ index = -1 ;
600644 $ payload ['LocalSecondaryIndexes ' ] = [];
@@ -654,6 +698,16 @@ private function requestBody(): array
654698 if (null !== $ v = $ this ->onDemandThroughput ) {
655699 $ payload ['OnDemandThroughput ' ] = $ v ->requestBody ();
656700 }
701+ if (null !== $ v = $ this ->globalTableSourceArn ) {
702+ $ payload ['GlobalTableSourceArn ' ] = $ v ;
703+ }
704+ if (null !== $ v = $ this ->globalTableSettingsReplicationMode ) {
705+ if (!GlobalTableSettingsReplicationMode::exists ($ v )) {
706+ /** @psalm-suppress NoValue */
707+ throw new InvalidArgument (\sprintf ('Invalid parameter "GlobalTableSettingsReplicationMode" for "%s". The value "%s" is not a valid "GlobalTableSettingsReplicationMode". ' , __CLASS__ , $ v ));
708+ }
709+ $ payload ['GlobalTableSettingsReplicationMode ' ] = $ v ;
710+ }
657711
658712 return $ payload ;
659713 }
0 commit comments