File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -811,20 +811,24 @@ def prepare_lsi_for_restore(lsi):
811
811
}
812
812
813
813
814
- def prepare_gsi_for_restore (gsi ):
814
+ def prepare_gsi_for_restore (gsi , billing_mode ):
815
815
"""
816
816
This function makes sure that the payload returned for the boto3 API call create_table is compatible
817
817
See: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html
818
818
"""
819
- return {
819
+ result = {
820
820
"IndexName" : gsi ["IndexName" ],
821
821
"KeySchema" : gsi ["KeySchema" ],
822
822
"Projection" : gsi ["Projection" ],
823
- "ProvisionedThroughput" : prepare_provisioned_throughput_for_restore (
824
- gsi ["ProvisionedThroughput" ]
825
- ),
826
823
}
827
824
825
+ if billing_mode != PAY_PER_REQUEST_BILLING_MODE :
826
+ result ["ProvisionedThroughput" ] = prepare_provisioned_throughput_for_restore (
827
+ gsi ["ProvisionedThroughput" ]
828
+ )
829
+
830
+ return result
831
+
828
832
829
833
def do_restore (
830
834
dynamo ,
@@ -952,7 +956,8 @@ def do_restore(
952
956
953
957
if table_global_secondary_indexes is not None :
954
958
optional_args ["GlobalSecondaryIndexes" ] = [
955
- prepare_gsi_for_restore (gsi ) for gsi in table_global_secondary_indexes
959
+ prepare_gsi_for_restore (gsi , billing_mode )
960
+ for gsi in table_global_secondary_indexes
956
961
]
957
962
958
963
while True :
You can’t perform that action at this time.
0 commit comments