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):
811811 }
812812
813813
814- def prepare_gsi_for_restore (gsi ):
814+ def prepare_gsi_for_restore (gsi , billing_mode ):
815815 """
816816 This function makes sure that the payload returned for the boto3 API call create_table is compatible
817817 See: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html
818818 """
819- return {
819+ result = {
820820 "IndexName" : gsi ["IndexName" ],
821821 "KeySchema" : gsi ["KeySchema" ],
822822 "Projection" : gsi ["Projection" ],
823- "ProvisionedThroughput" : prepare_provisioned_throughput_for_restore (
824- gsi ["ProvisionedThroughput" ]
825- ),
826823 }
827824
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+
828832
829833def do_restore (
830834 dynamo ,
@@ -952,7 +956,8 @@ def do_restore(
952956
953957 if table_global_secondary_indexes is not None :
954958 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
956961 ]
957962
958963 while True :
You can’t perform that action at this time.
0 commit comments