awslabs / dynein

DynamoDB CLI written in Rust.
https://github.com/awslabs/dynein
Apache License 2.0
360 stars 37 forks source link

`dy admin update table --mode provisioned` fails if a table has an index #228

Open StoneDot opened 4 months ago

StoneDot commented 4 months ago

Currently, dy admin update table --mode provisioned fails if a table has an index. The request parameter of UpdateTable API does not seem to provide a provisioned capacity for indices.

❯ dy admin admin create table test --keys pk,S sk,S --region ap-northeast-1
name: test
region: ap-northeast-1
status: CREATING
schema:
  pk: pk (S)
  sk: sk (S)
mode: OnDemand
capacity: null
gsi: null
lsi: null
stream: null
count: 0
size_bytes: 0
created_at: 2024-05-14T13:29:11+00:00

❯ dy admin use test --region ap-northeast-1
Now you're using the table 'test' (ap-northeast-1).

❯ dy admin create index idx --keys gsipk,S gsisk,S
name: test
region: ap-northeast-1
status: UPDATING
schema:
  pk: pk (S)
  sk: sk (S)
mode: OnDemand
capacity: null
gsi:
- name: idx
  schema:
    pk: gsipk (S)
    sk: gsisk (S)
  capacity: null
lsi: null
stream: null
count: 0
size_bytes: 0
created_at: 2024-05-14T13:29:11+00:00

❯ dy admin update table test --mode provisioned --rcu 5 --wcu 10
**snip**
[2024-05-14T13:36:37Z DEBUG dy::control] UpdateTable API call got an error -- Validation(
        "One or more parameter values were invalid: ProvisionedThroughput must be specified for index: idx",
    )
[2024-05-14T13:36:37Z ERROR dy::control] One or more parameter values were invalid: ProvisionedThroughput must be specified for index: idx