dyna 0.1.8 → 0.1.9
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 +4 -4
- data/README.md +78 -9
- data/bin/dyna +11 -6
- data/lib/dyna/client.rb +10 -1
- data/lib/dyna/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf7e0af4635d19cc04464734c752ec8f68032ea3
|
4
|
+
data.tar.gz: 68e76221165d0268c622001e07190ca753894c81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9940c92ee88b999d0a9a5a8ba7f745b4d9afd900773fdd7b512c85d289318dbbd81877c4217e569a7ee2b697dabcb0c61d9ac2be45c67cc3ff464dc01def0914
|
7
|
+
data.tar.gz: 0a2aee89b5f14f22171dfd4a43b9235d9143af4b39b44e66023b0137b53037874b57d89975d70ec9f7864c74ed440f17d5108dbc706c023d5e02b2924a055e0b
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Dyna
|
2
2
|
|
3
|
-
|
3
|
+
Dyna is a tool to manage DynamoDB Table.
|
4
4
|
|
5
|
-
|
5
|
+
It defines the state of DynamoDB Table using DSL, and updates DynamoDB Table according to DSL.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -22,20 +22,89 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
```sh
|
26
|
+
export AWS_ACCESS_KEY_ID='...'
|
27
|
+
export AWS_SECRET_ACCESS_KEY='...'
|
28
|
+
export AWS_REGION='ap-northeast-1'
|
29
|
+
dyna -e -o Dynafile # export DynamoDB Table
|
30
|
+
vi Dynafile
|
31
|
+
dyna -a --dry-run
|
32
|
+
dyna -a # apply `Dyanfile` to DynamoDB
|
33
|
+
```
|
26
34
|
|
27
|
-
##
|
35
|
+
## Help
|
28
36
|
|
29
|
-
|
37
|
+
```
|
38
|
+
Usage: dyna [options]
|
39
|
+
-p, --profile PROFILE_NAME
|
40
|
+
--credentials-path PATH
|
41
|
+
-k, --access-key ACCESS_KEY
|
42
|
+
-s, --secret-key SECRET_KEY
|
43
|
+
-r, --region REGION
|
44
|
+
-a, --apply
|
45
|
+
-f, --file FILE
|
46
|
+
-n, --table_names TABLE_LIST
|
47
|
+
-x, --exclude_table_names TABLE_LIST
|
48
|
+
--dry-run
|
49
|
+
-e, --export
|
50
|
+
-o, --output FILE
|
51
|
+
--split
|
52
|
+
--no-color
|
53
|
+
--debug
|
54
|
+
```
|
30
55
|
|
31
|
-
|
56
|
+
## Dynafile example
|
32
57
|
|
33
|
-
|
58
|
+
```ruby
|
59
|
+
require 'other/dynafile'
|
60
|
+
|
61
|
+
dynamo_db "ap-northeast-1" do
|
62
|
+
table "test_table" do
|
63
|
+
key_schema(
|
64
|
+
hash: "ForumName",
|
65
|
+
range: "Subject"
|
66
|
+
)
|
67
|
+
|
68
|
+
attribute_definition(
|
69
|
+
attribute_name: "ForumName",
|
70
|
+
attribute_type: "S",
|
71
|
+
)
|
72
|
+
attribute_definition(
|
73
|
+
attribute_name: "Subject",
|
74
|
+
attribute_type: "S",
|
75
|
+
)
|
76
|
+
|
77
|
+
provisioned_throughput(
|
78
|
+
read_capacity_units: 1,
|
79
|
+
write_capacity_units: 2,
|
80
|
+
)
|
81
|
+
|
82
|
+
local_secondary_index "LocalIndexName" do
|
83
|
+
key_schema hash: "ForumName", range: "Subject"
|
84
|
+
projection projection_type: "ALL"
|
85
|
+
end
|
86
|
+
|
87
|
+
global_secondary_index "GlobalIndexName" do
|
88
|
+
key_schema hash: "ForumName", range: "Subject"
|
89
|
+
projection projection_type: "ALL"
|
90
|
+
provisioned_throughput read_capacity_units: 1, write_capacity_units: 2
|
91
|
+
end
|
92
|
+
|
93
|
+
stream_specification(
|
94
|
+
stream_enabled: true,
|
95
|
+
stream_view_type: "NEW_AND_OLD_IMAGES",
|
96
|
+
)
|
97
|
+
end
|
98
|
+
```
|
99
|
+
|
100
|
+
## Similar tools
|
34
101
|
|
35
|
-
|
102
|
+
* [Codenize.tools](http://codenize.tools/)
|
36
103
|
|
104
|
+
## Contributing
|
105
|
+
|
106
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/wata-gh/dyna.
|
37
107
|
|
38
108
|
## License
|
39
109
|
|
40
110
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
-
|
data/bin/dyna
CHANGED
@@ -44,21 +44,26 @@ ARGV.options do |opt|
|
|
44
44
|
opt.on('-k', '--access-key ACCESS_KEY') {|v| access_key = v }
|
45
45
|
opt.on('-s', '--secret-key SECRET_KEY') {|v| secret_key = v }
|
46
46
|
opt.on('-r', '--region REGION') {|v| region = v }
|
47
|
-
opt.on('-
|
47
|
+
opt.on('-l', '--use-local') { options[:use_local] = true }
|
48
|
+
opt.on('-a', '--apply') { mode = :apply }
|
48
49
|
opt.on('-f', '--file FILE') {|v| file = v }
|
49
50
|
opt.on('', '--table_names TABLE_NAMES', Array) {|v| options[:table_names] = v }
|
50
51
|
opt.on('', '--exclude_table_names TABLE_NAMES', Array) {|v| options[:exclude_table_names] = v }
|
51
|
-
opt.on('', '--dry-run') {
|
52
|
-
opt.on('-e', '--export') {
|
52
|
+
opt.on('', '--dry-run') { options[:dry_run] = true }
|
53
|
+
opt.on('-e', '--export') { mode = :export}
|
53
54
|
opt.on('-o', '--output FILE') {|v| output_file = v }
|
54
|
-
opt.on('', '--split') {
|
55
|
-
opt.on('', '--split-more') {
|
55
|
+
opt.on('', '--split') { split = true }
|
56
|
+
opt.on('', '--split-more') { split = :more }
|
56
57
|
opt.on('' , '--no-color') { options[:color] = false }
|
57
58
|
opt.on('' , '--debug') { options[:debug] = true }
|
58
59
|
opt.parse!
|
59
60
|
|
60
61
|
aws_opts = {}
|
61
|
-
if
|
62
|
+
if options[:use_local]
|
63
|
+
options[:access_key_id] = access_key if access_key
|
64
|
+
options[:secret_access_key] = secret_key if secret_key
|
65
|
+
options[:region] = region if region
|
66
|
+
elsif access_key and secret_key
|
62
67
|
aws_opts = {
|
63
68
|
:access_key_id => access_key,
|
64
69
|
:secret_access_key => secret_key,
|
data/lib/dyna/client.rb
CHANGED
@@ -6,7 +6,16 @@ module Dyna
|
|
6
6
|
def initialize(options = {})
|
7
7
|
@options = OpenStruct.new(options)
|
8
8
|
@options_hash = options
|
9
|
-
@options.
|
9
|
+
if @options.use_local
|
10
|
+
@options.ddb = Aws::DynamoDB::Client.new(
|
11
|
+
endpoint: @options.dynamo_endpoint || 'http://127.0.0.1:8000',
|
12
|
+
region: @options.region || 'ap-northeast-1',
|
13
|
+
access_key_id: @options.access_key_id || 'dummy',
|
14
|
+
secret_access_key: @options.secret_access_key || 'dummy',
|
15
|
+
)
|
16
|
+
else
|
17
|
+
@options.ddb = Aws::DynamoDB::Client.new
|
18
|
+
end
|
10
19
|
end
|
11
20
|
|
12
21
|
def apply(file)
|
data/lib/dyna/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dyna
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wata
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|