ebfly 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c89ec5eb6ba42bccb9da25f1ee5cdaaa319c7af5
4
- data.tar.gz: 0f491907d37f7a4b2a60591b96893067d23d411f
3
+ metadata.gz: 8e8a96e5ccb8ced1ef344f6c7143f36d0b15ad1f
4
+ data.tar.gz: 3e00a03a3538a793353f9468f164097ca283ddff
5
5
  SHA512:
6
- metadata.gz: 9f24ac352294b6b5a9dc1a5bc87b7f04e73b4444bcd29ef06075cd2c63975883c2269299861bb79c9fbca34206c1c804455b0572639afd237d1d1b2478835bfb
7
- data.tar.gz: f7c7f7a1c29141fe421a2b4aa6260e9b0b16071b627c1053844a816fea775855d79e72a647d8bd7e5435c04399c021e04d8f57b8e1b5f63c69bd9fed3c0a0fd1
6
+ metadata.gz: ff0ba53d8bec8b3edfb94a1b6d65abec6a2079392fa86c19ddc572c113a5d1b41f2329202bd6fddfd465d9d9bb728fd564994d65044b9eb09280a51828575a89
7
+ data.tar.gz: 3bae350983e6ff4e6cd195a51775e4cfab323156476ebeb0618c3334b2191949c11f68d10640101d336c9e08aa9eab04fdc809ede288dd87015d86c9e36c7bb3
data/docs/env.md CHANGED
@@ -6,6 +6,7 @@
6
6
 
7
7
  - [create](#create)
8
8
  - [delete](#delete)
9
+ - [update](#update)
9
10
  - [info](#info)
10
11
  - [open](#open)
11
12
  - [push](#push)
@@ -16,7 +17,7 @@
16
17
  Create an environment.
17
18
 
18
19
  ```
19
- ebfly env create [name] -a [app] -s [stack] -t [tier] -l [label] -d [desc]
20
+ ebfly env create [name] -a [app] -s [stack] -t [tier] -l [label] -o [namespace-key=value ...] -d [desc]
20
21
  ```
21
22
 
22
23
  #### Options
@@ -27,6 +28,7 @@ ebfly env create [name] -a [app] -s [stack] -t [tier] -l [label] -d [desc]
27
28
  | -s | The Solution stack name to create. Some [predefined values](#predefined_values) are available. | Yes |
28
29
  | -t | Tier type, value must be `web` or `worker`. Default value is `web` | No |
29
30
  | -l | The name of the application version to deploy | No |
31
+ | -o | ElasticBeanstalk option values. For detail see [Option Values](#option_values) section | No |
30
32
  | -d | The description of the application. | No |
31
33
 
32
34
  #### Examples
@@ -37,10 +39,10 @@ Create Ruby 1.9 web environment.
37
39
  ebfly env create envname -a app -s ruby19 -t web
38
40
  ```
39
41
 
40
- Create Python 2.7 worker environment.
42
+ Create Python 2.7 worker environment with option values.
41
43
 
42
44
  ```
43
- ebfly env create envname -a app -s python27 -t worker
45
+ ebfly env create envname -a app -s python27 -t worker -o -o sqsd-MimeType="text/plain" sqsd-HttpPath="/enqueue"
44
46
  ```
45
47
 
46
48
  <a name="predefined_values"></a>
@@ -73,6 +75,24 @@ ebfly env delete [name] -a [app]
73
75
  | ---- | ------------------------------------------- | -------- |
74
76
  | -a | The application name to create environment. | Yes |
75
77
 
78
+ <a name="update"></a>
79
+ ### update
80
+
81
+ Update an environment.
82
+
83
+ ```
84
+ ebfly env update [name] -a [app] -l [label] -o [namespace-key=value ...] -d [desc]
85
+ ```
86
+
87
+ #### Options
88
+
89
+ | Name | Description | Required |
90
+ | ---- | ---------------------------------------------------------------------------------------------- | -------- |
91
+ | -a | The application name to create environment. | Yes |
92
+ | -l | The name of the application version to deploy | No |
93
+ | -o | ElasticBeanstalk option values. For detail see [Option Values](#option_values) section | No |
94
+ | -d | The description of the application. | No |
95
+
76
96
  <a name="info"></a>
77
97
  ### info
78
98
 
@@ -130,3 +150,38 @@ Push specified commit `66c598c` to the environment.
130
150
  ```
131
151
  ebfly env push envname 66c598c -a app
132
152
  ```
153
+
154
+ <a href="option_values"></a>
155
+ ## Option Values
156
+
157
+ Option values format is `namespace-key=value` style.
158
+ Which `namespace`, `key` and `value` can be used is describe at [AWS Elastic Beanstalk official document](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options.html).
159
+
160
+ You can use short `namespace` as followings.
161
+
162
+ | Short namespace | Real namespace |
163
+ | -------------------- | ------------------------------------------- |
164
+ | asg | aws:autoscaling:asg |
165
+ | launchconfiguration | aws:autoscaling:launchconfiguration |
166
+ | trigger | aws:autoscaling:trigger |
167
+ | rollingupdate | aws:autoscaling:updatepolicy:rollingupdate |
168
+ | vpc | aws:ec2:vpc |
169
+ | application | aws:elasticbeanstalk:application |
170
+ | command | aws:elasticbeanstalk:command |
171
+ | environment | aws:elasticbeanstalk:environment |
172
+ | monitoring | aws:elasticbeanstalk:monitoring |
173
+ | topics | aws:elasticbeanstalk:sns:topics |
174
+ | sqsd | aws:elasticbeanstalk:sqsd |
175
+ | healthcheck | aws:elb:healthcheck |
176
+ | loadbalancer | aws:elb:loadbalancer |
177
+ | policies | aws:elb:policies |
178
+ | dbinstance | aws:rds:dbinstance |
179
+ | hostmanager | aws:elasticbeanstalk:hostmanager |
180
+
181
+ ### Example
182
+
183
+ Set `InstanceType` of `aws:autoscaling:launchconfiguration` to `m1.small`
184
+
185
+ ```
186
+ ebfly env update name -a app -o launchconfiguration-InstanceType="m1.small"
187
+ ```
data/lib/ebfly/cli.rb CHANGED
@@ -3,6 +3,7 @@ require "aws-sdk"
3
3
 
4
4
  require_relative 'ebfly'
5
5
  require_relative 'version'
6
+ require_relative 'options'
6
7
  require_relative 'command/app'
7
8
  require_relative 'command/env'
8
9
  require_relative 'command/config'
@@ -1,6 +1,7 @@
1
1
  module Ebfly
2
2
  class Environment < Thor
3
3
  include Command
4
+ include Options
4
5
 
5
6
  desc "create <name>", "Create an environment named <name>"
6
7
  option :a, :required => true, :banner => "<app>", :desc => "Application name"
@@ -8,6 +9,7 @@ module Ebfly
8
9
  option :t, :banner => "<tier>", :default => "web", :desc => "Tier type (web|worker)"
9
10
  option :d, :banner => "<description>", :desc => "Describes the environment"
10
11
  option :l, :banner => "<label>", :desc => "The name of the application version to deploy"
12
+ option :o, :banner => "<namespace:key=value ...>", :type => :array, :desc => "ElasticBeanstalk option values. See http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options.html"
11
13
  def create(name)
12
14
  app = options[:a]
13
15
  puts "Create environment: #{env_name(app, name)} ..."
@@ -18,7 +20,8 @@ module Ebfly
18
20
  tier: tier(options[:t])
19
21
  }
20
22
  opts.merge!(description: options[:d]) if options[:d]
21
- opts.merge!(version_label: options[:v]) if options[:v]
23
+ opts.merge!(version_label: options[:l]) if options[:l]
24
+ opts.merge!(option_settings: parse_option_values(options[:o])) if options[:o] and !options[:o].empty?
22
25
 
23
26
  debug opts
24
27
  ret = run { eb.create_environment(opts) }
@@ -37,6 +40,26 @@ module Ebfly
37
40
  puts "Done"
38
41
  end
39
42
 
43
+ desc "update <name>", "Update the specified environment"
44
+ option :a, :required => true, :banner => "<app>", :desc => "Application name"
45
+ option :d, :banner => "<description>", :desc => "Describes the environment"
46
+ option :l, :banner => "<label>", :desc => "The name of the application version to deploy"
47
+ option :o, :banner => "<namespace:key=value ...>", :type => :array, :desc => "ElasticBeanstalk option values. See http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options.html"
48
+ def update(name)
49
+ app = options[:a]
50
+ puts "Update environment: #{env_name(app, name)} ..."
51
+ opts = {
52
+ environment_name: env_name(app, name)
53
+ }
54
+ opts.merge!(description: options[:d]) if options[:d]
55
+ opts.merge!(version_label: options[:l]) if options[:l]
56
+ opts.merge!(option_settings: parse_option_values(options[:o])) if options[:o] and !options[:o].empty?
57
+
58
+ debug(opts)
59
+ ret = run { eb.update_environment(opts) }
60
+ show_env_info(ret)
61
+ end
62
+
40
63
  desc "info <name>", "Show the specified environment information."
41
64
  option :a, :required => true, :banner => "<app>", :desc => "Application name"
42
65
  option :r, :default => false, :desc => "Show environment resources"
@@ -0,0 +1,45 @@
1
+ # Hndle Option values.
2
+ #
3
+ # http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options.html
4
+
5
+ module Ebfly
6
+ module Options
7
+ NAMESPACES = {
8
+ "asg" => "aws:autoscaling:asg",
9
+ "launchconfiguration" => "aws:autoscaling:launchconfiguration",
10
+ "trigger" => "aws:autoscaling:trigger",
11
+ "rollingupdate" => "aws:autoscaling:updatepolicy:rollingupdate",
12
+ "vpc" => "aws:ec2:vpc",
13
+ "application" => "aws:elasticbeanstalk:application",
14
+ "command" => "aws:elasticbeanstalk:command",
15
+ "environment" => "aws:elasticbeanstalk:environment",
16
+ "monitoring" => "aws:elasticbeanstalk:monitoring",
17
+ "topics" => "aws:elasticbeanstalk:sns:topics",
18
+ "sqsd" => "aws:elasticbeanstalk:sqsd",
19
+ "healthcheck" => "aws:elb:healthcheck",
20
+ "loadbalancer" => "aws:elb:loadbalancer",
21
+ "policies" => "aws:elb:policies",
22
+ "dbinstance" => "aws:rds:dbinstance",
23
+ "hostmanager" => "aws:elasticbeanstalk:hostmanager"
24
+ }
25
+
26
+ def parse_option_values(option_values)
27
+ ret = []
28
+ option_values.each do |ov|
29
+ k, value = ov.split('=')
30
+ next if value.nil?
31
+
32
+ ns, key = k.split('-')
33
+ namespace = NAMESPACES[ns.strip]
34
+ namespace = ns unless namespace
35
+
36
+ ret << {
37
+ namespace: namespace,
38
+ option_name: key.strip,
39
+ value: value.strip
40
+ }
41
+ end
42
+ ret
43
+ end
44
+ end
45
+ end
data/lib/ebfly/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ebfly
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ebfly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuyuki Honda
@@ -60,6 +60,7 @@ files:
60
60
  - lib/ebfly/command/config.rb
61
61
  - lib/ebfly/command/env.rb
62
62
  - lib/ebfly/ebfly.rb
63
+ - lib/ebfly/options.rb
63
64
  - lib/ebfly/version.rb
64
65
  homepage: https://github.com/hakobera/ebifly
65
66
  licenses: