ddbcli 0.3.7 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37f0584f12c1b1b9c904f363ce23ba77a393ae9e
4
- data.tar.gz: 06d7388329435968444a42a61419466084b65483
3
+ metadata.gz: 0043de0270c140bdb072514660ae8f066f151f6e
4
+ data.tar.gz: e38be5ea35a5e423137a942791aef4c27a637375
5
5
  SHA512:
6
- metadata.gz: 6704684fbd7871d2208ab74efd4008d5ce7ae695c6a8058316c190e531a49225a307b86b0f35c32cf386174c40037e52ee288deccaf8133de7aa3b11b4b9314e
7
- data.tar.gz: 98aa7d6912dc88001a641d9acfbe9b12888212f8e900973cbffca9af2ce6011f9ce21f9fdc40a1e3bc13c667d12ccd5ff81cbb50f19798b0128e8166d957a68b
6
+ metadata.gz: 02701f2b2218109a15ff333137902518399aed9b62adc3fce54a34893e9b757f1903a0bae90046ceab58ab2c89330afb9ed26c90657f17589b59c02a99ab1b20
7
+ data.tar.gz: f9dd54e271ace36069517e1322d5cad66433a43ebcfc5cfd92513f6352c0440a0ef0e5cdab1de6ba2822318978d105f60e0220642df7e9ffd5fd0f94f20396ad
data/README.md CHANGED
@@ -11,11 +11,11 @@ ddbcli is an interactive command-line client of Amazon DynamoDB.
11
11
 
12
12
  If you are not using RubyGems, you can use the script files that depend on only Ruby.
13
13
 
14
- [ddbcli-0.3.7](https://bitbucket.org/winebarrel/ddbcli/downloads/ddbcli-0.3.7)
14
+ [ddbcli-0.3.8](https://bitbucket.org/winebarrel/ddbcli/downloads/ddbcli-0.3.8)
15
15
 
16
16
  ```sh
17
- wget https://bitbucket.org/winebarrel/ddbcli/downloads/ddbcli-0.3.7
18
- mv ddbcli-0.3.7 ddbcli
17
+ wget https://bitbucket.org/winebarrel/ddbcli/downloads/ddbcli-0.3.8
18
+ mv ddbcli-0.3.8 ddbcli
19
19
  chmod 755 ddbcli
20
20
  ./ddbcli # show prompt
21
21
  ```
@@ -108,6 +108,9 @@ DROP TABLE table_name [, table_name2, ...]
108
108
  ALTER TABLE table_name READ = num WRITE = num
109
109
  updates the provisioned throughput
110
110
 
111
+ ALTER TABLE table_name CHANGE INDEX index_name READ = num WRITE = num
112
+ updates GSI provisioned throughput
113
+
111
114
  GET {*|attr1,attr2,...} FROM table_name WHERE key1 = '...' AND ...
112
115
  gets items
113
116
 
@@ -37,6 +37,9 @@ DROP TABLE table_name [, table_name2, ...]
37
37
  ALTER TABLE table_name READ = num WRITE = num
38
38
  updates the provisioned throughput
39
39
 
40
+ ALTER TABLE table_name CHANGE INDEX index_name READ = num WRITE = num
41
+ updates GSI provisioned throughput
42
+
40
43
  GET {*|attr1,attr2,...} FROM table_name WHERE key1 = '...' AND ...
41
44
  gets items
42
45
 
@@ -212,6 +212,37 @@ module DynamoDB
212
212
  %w(ReadCapacityUnits WriteCapacityUnits).each do |i|
213
213
  h[table_name][i] = provisioned_throughput[i]
214
214
  end
215
+
216
+ lsis = table_info.fetch('LocalSecondaryIndexes', [])
217
+
218
+ unless lsis.empty?
219
+ lsi_h = h[table_name]['LocalSecondaryIndexes'] = {}
220
+
221
+ lsis.each do |lsi|
222
+ lsi_h[lsi['IndexName']] = {
223
+ 'IndexSizeBytes' => lsi['IndexSizeBytes'],
224
+ 'ItemCount' => lsi['ItemCount'],
225
+ }
226
+ end
227
+ end
228
+
229
+ gsis = table_info.fetch('GlobalSecondaryIndexes', [])
230
+
231
+ unless gsis.empty?
232
+ gsi_h = h[table_name]['GlobalSecondaryIndexes'] = {}
233
+
234
+ gsis.each do |gsi|
235
+ gsi_h[gsi['IndexName']] = {
236
+ 'IndexSizeBytes' => gsi['IndexSizeBytes'],
237
+ 'IndexStatus' => gsi['IndexStatus'],
238
+ 'ItemCount' => gsi['ItemCount'],
239
+ 'ProvisionedThroughput' => {
240
+ 'ReadCapacityUnits' => gsi['ProvisionedThroughput']['ReadCapacityUnits'],
241
+ 'WriteCapacityUnits' => gsi['ProvisionedThroughput']['WriteCapacityUnits'],
242
+ },
243
+ }
244
+ end
245
+ end
215
246
  end
216
247
 
217
248
  return h
@@ -319,14 +350,23 @@ module DynamoDB
319
350
  end
320
351
 
321
352
  def do_alter_table(parsed)
322
- req_hash = {
323
- 'TableName' => parsed.table,
324
- 'ProvisionedThroughput' => {
325
- 'ReadCapacityUnits' => parsed.capacity[:read],
326
- 'WriteCapacityUnits' => parsed.capacity[:write],
327
- },
353
+ req_hash = {'TableName' => parsed.table}
354
+ throughput = {
355
+ 'ReadCapacityUnits' => parsed.capacity[:read],
356
+ 'WriteCapacityUnits' => parsed.capacity[:write]
328
357
  }
329
358
 
359
+ if parsed.index_name
360
+ req_hash['GlobalSecondaryIndexUpdates'] = [{
361
+ 'Update' => {
362
+ 'IndexName' => parsed.index_name,
363
+ 'ProvisionedThroughput' => throughput,
364
+ },
365
+ }]
366
+ else
367
+ req_hash['ProvisionedThroughput'] = throughput
368
+ end
369
+
330
370
  @client.query('UpdateTable', req_hash)
331
371
  nil
332
372
  end