lita-aws-ecs 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +67 -0
- data/.gitignore +4 -0
- data/.rspec +4 -0
- data/.rubocop.yml +9 -0
- data/.rubocop_todo.yml +20 -0
- data/.ruby-version +1 -0
- data/CODE_OF_CONDUCT.md +75 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +161 -0
- data/Guardfile +49 -0
- data/LICENSE.txt +22 -0
- data/README.md +1 -0
- data/Rakefile +8 -0
- data/lib/lita/handlers/aws_ecs.rb +123 -0
- data/lib/lita-aws-ecs.rb +14 -0
- data/lita-aws-ecs.gemspec +33 -0
- data/locales/en.yml +103 -0
- data/locales/ja.yml +104 -0
- data/pkg/lita-aws-ecs-0.1.0.gem +0 -0
- data/spec/lita/handlers/aws_ecs_spec.rb +294 -0
- data/spec/spec_helper.rb +19 -0
- data/templates/.gitkeep +0 -0
- data/templates/cluster_component.erb +13 -0
- data/templates/cluster_services.erb +10 -0
- data/templates/cluster_tasks.erb +10 -0
- data/templates/clusters.erb +10 -0
- data/templates/service_tasks.erb +10 -0
- data/templates/service_update.erb +10 -0
- metadata +256 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fe16c0690b7a6a4b80c9f28bd514d25ed5222de0380add07b1c2974550d3b213
|
4
|
+
data.tar.gz: f17df8634a2dd3227fdf02a83a9a940cc0b1f2bd4e5f91c02c821730f4351b74
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 248a2093cc7a02c60cd6eb7372f7daaeb3a7b63153283f8c23ee1c750f78d78630be2b89454638b3d6d0c0a1cc5972795787df5adf4607c610404d692073f7ab
|
7
|
+
data.tar.gz: cec1b562a39666c1ca59c445ac498640066dc6a2c7f7db09635857867f6c981153a8b53ed0f7591e1f1a6eb71a3fef8af192f8d1bea8dd3211072ff11d6982f4
|
@@ -0,0 +1,67 @@
|
|
1
|
+
version: 2.1
|
2
|
+
|
3
|
+
update_bundler: &update_bundler
|
4
|
+
run:
|
5
|
+
name: update bundler
|
6
|
+
command: gem update bundler
|
7
|
+
|
8
|
+
bundle_install: &bundle_install
|
9
|
+
run:
|
10
|
+
name: bundle install
|
11
|
+
command: bundle update --bundler && bundle install --path vendor/bundle --jobs 4
|
12
|
+
|
13
|
+
restore_bundle_cache: &restore_bundle_cache
|
14
|
+
restore_cache:
|
15
|
+
key: cache-bundler-{{ checksum "Gemfile.lock" }}
|
16
|
+
|
17
|
+
wait_redis_service: &wait_redis_service
|
18
|
+
run:
|
19
|
+
name: wait for redis
|
20
|
+
command: dockerize -wait tcp://127.0.0.1:6379 -timeout 1m
|
21
|
+
|
22
|
+
jobs:
|
23
|
+
build:
|
24
|
+
docker:
|
25
|
+
- image: circleci/ruby
|
26
|
+
steps:
|
27
|
+
- checkout
|
28
|
+
- *restore_bundle_cache
|
29
|
+
- *update_bundler
|
30
|
+
- *bundle_install
|
31
|
+
- save_cache:
|
32
|
+
key: cache-bundler-{{ checksum "Gemfile.lock" }}
|
33
|
+
paths:
|
34
|
+
- vendor/bundle
|
35
|
+
rubocop:
|
36
|
+
docker:
|
37
|
+
- image: circleci/ruby
|
38
|
+
steps:
|
39
|
+
- checkout
|
40
|
+
- *restore_bundle_cache
|
41
|
+
- *update_bundler
|
42
|
+
- *bundle_install
|
43
|
+
- run: bundle exec rubocop
|
44
|
+
rspec:
|
45
|
+
docker:
|
46
|
+
- image: circleci/ruby
|
47
|
+
- image: redis
|
48
|
+
steps:
|
49
|
+
- checkout
|
50
|
+
- *restore_bundle_cache
|
51
|
+
- *update_bundler
|
52
|
+
- *bundle_install
|
53
|
+
- run:
|
54
|
+
environment:
|
55
|
+
RAILS_ENV: test
|
56
|
+
COVERAGE: true
|
57
|
+
CODECOV_TOKEN: c8c31078-b811-4301-bd35-c36e14cfc075
|
58
|
+
command: bundle exec rspec
|
59
|
+
workflows:
|
60
|
+
version: 2.1
|
61
|
+
rspec:
|
62
|
+
jobs:
|
63
|
+
- build
|
64
|
+
- rubocop:
|
65
|
+
requires: [build]
|
66
|
+
- rspec:
|
67
|
+
requires: [build]
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2019-09-06 10:39:14 +0900 using RuboCop version 0.74.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
11
|
+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
|
12
|
+
Naming/FileName:
|
13
|
+
Exclude:
|
14
|
+
- 'lib/lita-aws-ecs.rb'
|
15
|
+
|
16
|
+
# Offense count: 1
|
17
|
+
# Configuration parameters: .
|
18
|
+
# SupportedStyles: inline, group
|
19
|
+
Style/AccessModifierDeclarations:
|
20
|
+
EnforcedStyle: inline
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6.3
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at unhappychoice@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
75
|
+
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
lita-aws-ecs (0.1.0)
|
5
|
+
aws-sdk-ecs (~> 1)
|
6
|
+
lita (>= 4.7)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
ast (2.4.0)
|
12
|
+
aws-eventstream (1.0.3)
|
13
|
+
aws-partitions (1.260.0)
|
14
|
+
aws-sdk-core (3.86.0)
|
15
|
+
aws-eventstream (~> 1.0, >= 1.0.2)
|
16
|
+
aws-partitions (~> 1, >= 1.239.0)
|
17
|
+
aws-sigv4 (~> 1.1)
|
18
|
+
jmespath (~> 1.0)
|
19
|
+
aws-sdk-ecs (1.55.0)
|
20
|
+
aws-sdk-core (~> 3, >= 3.71.0)
|
21
|
+
aws-sigv4 (~> 1.1)
|
22
|
+
aws-sigv4 (1.1.0)
|
23
|
+
aws-eventstream (~> 1.0, >= 1.0.2)
|
24
|
+
byebug (11.0.1)
|
25
|
+
codecov (0.1.16)
|
26
|
+
json
|
27
|
+
simplecov
|
28
|
+
url
|
29
|
+
coderay (1.1.2)
|
30
|
+
concurrent-ruby (1.1.5)
|
31
|
+
diff-lcs (1.3)
|
32
|
+
docile (1.3.2)
|
33
|
+
faraday (0.17.1)
|
34
|
+
multipart-post (>= 1.2, < 3)
|
35
|
+
ffi (1.11.3)
|
36
|
+
formatador (0.2.5)
|
37
|
+
guard (2.16.1)
|
38
|
+
formatador (>= 0.2.4)
|
39
|
+
listen (>= 2.7, < 4.0)
|
40
|
+
lumberjack (>= 1.0.12, < 2.0)
|
41
|
+
nenv (~> 0.1)
|
42
|
+
notiffany (~> 0.0)
|
43
|
+
pry (>= 0.9.12)
|
44
|
+
shellany (~> 0.0)
|
45
|
+
thor (>= 0.18.1)
|
46
|
+
guard-compat (1.2.1)
|
47
|
+
guard-rspec (4.7.3)
|
48
|
+
guard (~> 2.1)
|
49
|
+
guard-compat (~> 1.1)
|
50
|
+
rspec (>= 2.99.0, < 4.0)
|
51
|
+
guard-rubocop (1.3.0)
|
52
|
+
guard (~> 2.0)
|
53
|
+
rubocop (~> 0.20)
|
54
|
+
http_router (0.11.2)
|
55
|
+
rack (>= 1.0.0)
|
56
|
+
url_mount (~> 0.2.1)
|
57
|
+
i18n (1.7.0)
|
58
|
+
concurrent-ruby (~> 1.0)
|
59
|
+
ice_nine (0.11.2)
|
60
|
+
jaro_winkler (1.5.4)
|
61
|
+
jmespath (1.4.0)
|
62
|
+
json (2.3.0)
|
63
|
+
listen (3.2.1)
|
64
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
65
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
66
|
+
lita (4.7.1)
|
67
|
+
bundler (>= 1.3)
|
68
|
+
faraday (>= 0.8.7)
|
69
|
+
http_router (>= 0.11.2)
|
70
|
+
i18n (>= 0.6.9)
|
71
|
+
ice_nine (>= 0.11.0)
|
72
|
+
multi_json (>= 1.7.7)
|
73
|
+
puma (>= 2.7.1)
|
74
|
+
rack (>= 1.5.2, < 2.0.0)
|
75
|
+
rb-readline (>= 0.5.1)
|
76
|
+
redis-namespace (>= 1.3.0)
|
77
|
+
thor (>= 0.18.1)
|
78
|
+
lumberjack (1.0.13)
|
79
|
+
method_source (0.9.2)
|
80
|
+
multi_json (1.14.1)
|
81
|
+
multipart-post (2.1.1)
|
82
|
+
nenv (0.3.0)
|
83
|
+
nio4r (2.5.2)
|
84
|
+
notiffany (0.1.3)
|
85
|
+
nenv (~> 0.1)
|
86
|
+
shellany (~> 0.0)
|
87
|
+
parallel (1.19.1)
|
88
|
+
parser (2.7.0.0)
|
89
|
+
ast (~> 2.4.0)
|
90
|
+
pry (0.12.2)
|
91
|
+
coderay (~> 1.1.0)
|
92
|
+
method_source (~> 0.9.0)
|
93
|
+
pry-byebug (3.7.0)
|
94
|
+
byebug (~> 11.0)
|
95
|
+
pry (~> 0.10)
|
96
|
+
puma (4.3.1)
|
97
|
+
nio4r (~> 2.0)
|
98
|
+
rack (1.6.12)
|
99
|
+
rack-test (1.1.0)
|
100
|
+
rack (>= 1.0, < 3)
|
101
|
+
rainbow (3.0.0)
|
102
|
+
rake (13.0.1)
|
103
|
+
rb-fsevent (0.10.3)
|
104
|
+
rb-inotify (0.10.1)
|
105
|
+
ffi (~> 1.0)
|
106
|
+
rb-readline (0.5.5)
|
107
|
+
redis (4.1.3)
|
108
|
+
redis-namespace (1.7.0)
|
109
|
+
redis (>= 3.0.4)
|
110
|
+
rspec (3.9.0)
|
111
|
+
rspec-core (~> 3.9.0)
|
112
|
+
rspec-expectations (~> 3.9.0)
|
113
|
+
rspec-mocks (~> 3.9.0)
|
114
|
+
rspec-core (3.9.0)
|
115
|
+
rspec-support (~> 3.9.0)
|
116
|
+
rspec-expectations (3.9.0)
|
117
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
118
|
+
rspec-support (~> 3.9.0)
|
119
|
+
rspec-mocks (3.9.0)
|
120
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
121
|
+
rspec-support (~> 3.9.0)
|
122
|
+
rspec-support (3.9.0)
|
123
|
+
rubocop (0.78.0)
|
124
|
+
jaro_winkler (~> 1.5.1)
|
125
|
+
parallel (~> 1.10)
|
126
|
+
parser (>= 2.6)
|
127
|
+
rainbow (>= 2.2.2, < 4.0)
|
128
|
+
ruby-progressbar (~> 1.7)
|
129
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
130
|
+
ruby-progressbar (1.10.1)
|
131
|
+
shellany (0.0.1)
|
132
|
+
simplecov (0.17.1)
|
133
|
+
docile (~> 1.1)
|
134
|
+
json (>= 1.8, < 3)
|
135
|
+
simplecov-html (~> 0.10.0)
|
136
|
+
simplecov-html (0.10.2)
|
137
|
+
thor (1.0.1)
|
138
|
+
unicode-display_width (1.6.0)
|
139
|
+
url (0.3.2)
|
140
|
+
url_mount (0.2.1)
|
141
|
+
rack
|
142
|
+
|
143
|
+
PLATFORMS
|
144
|
+
ruby
|
145
|
+
|
146
|
+
DEPENDENCIES
|
147
|
+
bundler (~> 2)
|
148
|
+
codecov
|
149
|
+
guard
|
150
|
+
guard-rspec
|
151
|
+
guard-rubocop
|
152
|
+
lita-aws-ecs!
|
153
|
+
pry-byebug
|
154
|
+
rack-test
|
155
|
+
rake
|
156
|
+
rspec (>= 3.0.0)
|
157
|
+
rubocop
|
158
|
+
simplecov
|
159
|
+
|
160
|
+
BUNDLED WITH
|
161
|
+
2.0.2
|
data/Guardfile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# A sample Guardfile
|
4
|
+
# More info at https://github.com/guard/guard#readme
|
5
|
+
|
6
|
+
## Uncomment and set this to only include directories you want to watch
|
7
|
+
# directories %w(app lib config test spec features) \
|
8
|
+
# .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
9
|
+
|
10
|
+
## Note: if you are using the `directories` clause above and you are not
|
11
|
+
## watching the project directory ('.'), then you will want to move
|
12
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
13
|
+
#
|
14
|
+
# $ mkdir config
|
15
|
+
# $ mv Guardfile config/
|
16
|
+
# $ ln -s config/Guardfile .
|
17
|
+
#
|
18
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
19
|
+
|
20
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
21
|
+
# rspec may be run, below are examples of the most common uses.
|
22
|
+
# * bundler: 'bundle exec rspec'
|
23
|
+
# * bundler binstubs: 'bin/rspec'
|
24
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
25
|
+
# installed the spring binstubs per the docs)
|
26
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
27
|
+
# * 'just' rspec: 'rspec'
|
28
|
+
|
29
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
30
|
+
require 'guard/rspec/dsl'
|
31
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
32
|
+
|
33
|
+
# Feel free to open issues for suggestions and improvements
|
34
|
+
|
35
|
+
# RSpec files
|
36
|
+
rspec = dsl.rspec
|
37
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
38
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
39
|
+
watch(rspec.spec_files)
|
40
|
+
|
41
|
+
# Ruby files
|
42
|
+
ruby = dsl.ruby
|
43
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
44
|
+
end
|
45
|
+
|
46
|
+
guard :rubocop do
|
47
|
+
watch(/.+\.rb$/)
|
48
|
+
watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
|
49
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Yuji Ueki
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'aws-sdk-ecs'
|
4
|
+
|
5
|
+
module Lita
|
6
|
+
module Handlers
|
7
|
+
class AwsEcs < Handler # rubocop:disable Metrics/ClassLength
|
8
|
+
config :aws_region
|
9
|
+
config :aws_access_key_id
|
10
|
+
config :aws_secret_access_key
|
11
|
+
|
12
|
+
clusters_help = { 'ecs clusters' => 'List ecs clusters' }
|
13
|
+
route(/ecs clusters$/, help: clusters_help) do |response|
|
14
|
+
clusters = client.list_clusters
|
15
|
+
response.reply(render_template('clusters', clusters: clusters))
|
16
|
+
rescue StandardError => e
|
17
|
+
response.reply ':rage: Error has occurred'
|
18
|
+
response.reply e.to_s
|
19
|
+
end
|
20
|
+
|
21
|
+
cluster_services_help = { 'ecs cluster services ${cluster_name}' => 'List ecs cluster services' }
|
22
|
+
route(/ecs cluster services\s+([a-zA-Z0-9 -~]+)\s*$/, help: cluster_services_help) do |response|
|
23
|
+
cluster_name = response.matches.first[0]
|
24
|
+
cluster_services = client.list_services(cluster: cluster_name)
|
25
|
+
response.reply(render_template('cluster_services', cluster_services: cluster_services))
|
26
|
+
rescue StandardError => e
|
27
|
+
response.reply ':rage: Error has occurred'
|
28
|
+
response.reply e.to_s
|
29
|
+
end
|
30
|
+
|
31
|
+
cluster_tasks_help = { 'ecs cluster tasks ${cluster_name}' => 'List ecs cluster tasks' }
|
32
|
+
route(/ecs cluster tasks\s+([a-zA-Z0-9 -~]+)\s*$/, help: cluster_tasks_help) do |response|
|
33
|
+
cluster_name = response.matches.first[0]
|
34
|
+
cluster_tasks = client.list_tasks(
|
35
|
+
cluster: cluster_name
|
36
|
+
)
|
37
|
+
response.reply(render_template('cluster_tasks', cluster_tasks: cluster_tasks))
|
38
|
+
rescue StandardError => e
|
39
|
+
response.reply ':rage: Error has occurred'
|
40
|
+
response.reply e.to_s
|
41
|
+
end
|
42
|
+
|
43
|
+
cluster_service_tasks_help =
|
44
|
+
{ 'ecs cluster service tasks ${cluster_name} ${service_name}' => 'List ecs cluster service tasks' }
|
45
|
+
route(/ecs cluster service tasks\s+([a-zA-Z0-9 -~]+)\s+([a-zA-Z0-9 -~]+)\s*$/,
|
46
|
+
help: cluster_service_tasks_help) do |response|
|
47
|
+
cluster_name = response.matches.first[0]
|
48
|
+
service_name = response.matches.first[1]
|
49
|
+
service_tasks = service_tasks_array(cluster_name, service_name)
|
50
|
+
response.reply(render_template('service_tasks', service_tasks: service_tasks))
|
51
|
+
rescue StandardError => e
|
52
|
+
response.reply ':rage: Error has occurred'
|
53
|
+
response.reply e.to_s
|
54
|
+
end
|
55
|
+
|
56
|
+
cluster_service_tasks_help =
|
57
|
+
{ 'ecs cluster component ${cluster_name}' => 'List cluster service name and task definition' }
|
58
|
+
route(/ecs cluster component\s+([a-zA-Z0-9 -~]+)\s*$/,
|
59
|
+
help: cluster_service_tasks_help) do |response|
|
60
|
+
cluster_name = response.matches.first[0]
|
61
|
+
services = client.list_services(cluster: cluster_name)
|
62
|
+
cluster_component = {}
|
63
|
+
services&.service_arns&.each do |service|
|
64
|
+
cluster_component[service] = service_tasks_array(cluster_name, service)
|
65
|
+
end
|
66
|
+
response
|
67
|
+
.reply(render_template(
|
68
|
+
'cluster_component',
|
69
|
+
cluster_name: cluster_name,
|
70
|
+
cluster_component: cluster_component
|
71
|
+
))
|
72
|
+
|
73
|
+
rescue StandardError => e
|
74
|
+
response.reply ':rage: Error has occurred'
|
75
|
+
response.reply e.to_s
|
76
|
+
end
|
77
|
+
|
78
|
+
clusters_service_update_help =
|
79
|
+
{ 'ecs cluster service update ${cluster_name} ${service_name} ${task_name}' => 'Update ecs service' }
|
80
|
+
route(/ecs cluster service update\s+([a-zA-Z0-9 -~]+)\s+([a-zA-Z0-9 -~]+)\s+([a-zA-Z0-9 -~]+)\s*$/,
|
81
|
+
help: clusters_service_update_help) do |response|
|
82
|
+
cluster_name = response.matches.first[0]
|
83
|
+
service_name = response.matches.first[1]
|
84
|
+
task_name = response.matches.first[2]
|
85
|
+
service_update = client.update_service(
|
86
|
+
cluster: cluster_name,
|
87
|
+
service: service_name,
|
88
|
+
task_definition: task_name
|
89
|
+
)
|
90
|
+
response.reply(render_template('service_update', service_update: service_update))
|
91
|
+
rescue StandardError => e
|
92
|
+
response.reply ':rage: Error has occurred'
|
93
|
+
response.reply e.to_s
|
94
|
+
end
|
95
|
+
|
96
|
+
private def service_tasks_array(cluster_name, service_name) # rubocop:disable Metrics/MethodLength
|
97
|
+
describe_services = client.describe_services(
|
98
|
+
cluster: cluster_name,
|
99
|
+
services: [
|
100
|
+
service_name
|
101
|
+
]
|
102
|
+
)
|
103
|
+
|
104
|
+
describe_service_tasks = []
|
105
|
+
unless describe_services.nil?
|
106
|
+
describe_services.services.each do |describe_service|
|
107
|
+
describe_service_tasks.push(describe_service.task_definition)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
describe_service_tasks
|
111
|
+
end
|
112
|
+
|
113
|
+
private def client
|
114
|
+
Aws::ECS::Client.new(
|
115
|
+
region: config.aws_region || ENV['AWS_REGION'],
|
116
|
+
access_key_id: config.aws_access_key_id || ENV['AWS_ACCESS_KEY_ID'],
|
117
|
+
secret_access_key: config.aws_secret_access_key || ENV['AWS_SECRET_ACCESS_KEY']
|
118
|
+
)
|
119
|
+
end
|
120
|
+
Lita.register_handler(self)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
data/lib/lita-aws-ecs.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'lita'
|
4
|
+
|
5
|
+
Lita.load_locales Dir[File.expand_path(
|
6
|
+
File.join('..', '..', 'locales', '*.yml'), __FILE__
|
7
|
+
)]
|
8
|
+
|
9
|
+
require 'lita/handlers/aws_ecs'
|
10
|
+
|
11
|
+
Lita::Handlers::AwsEcs.template_root File.expand_path(
|
12
|
+
File.join('..', '..', 'templates'),
|
13
|
+
__FILE__
|
14
|
+
)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = 'lita-aws-ecs'
|
5
|
+
spec.version = '0.1.0'
|
6
|
+
spec.authors = ['Teturo Nakamura']
|
7
|
+
spec.email = ['notify_company_questionnaire']
|
8
|
+
spec.description = 'Lita handler to manage ecs'
|
9
|
+
spec.summary = 'Lita handler to manage ecs'
|
10
|
+
spec.homepage = 'https://github.com/seibii/lita-aws-ecs'
|
11
|
+
spec.license = 'MIT'
|
12
|
+
spec.metadata = { 'lita_plugin_type' => 'handler' }
|
13
|
+
|
14
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
15
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
|
+
spec.require_paths = ['lib']
|
18
|
+
|
19
|
+
spec.add_runtime_dependency 'aws-sdk-ecs', '~> 1'
|
20
|
+
spec.add_runtime_dependency 'lita', '>= 4.7'
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 2'
|
23
|
+
spec.add_development_dependency 'codecov'
|
24
|
+
spec.add_development_dependency 'guard'
|
25
|
+
spec.add_development_dependency 'guard-rspec'
|
26
|
+
spec.add_development_dependency 'guard-rubocop'
|
27
|
+
spec.add_development_dependency 'pry-byebug'
|
28
|
+
spec.add_development_dependency 'rack-test'
|
29
|
+
spec.add_development_dependency 'rake'
|
30
|
+
spec.add_development_dependency 'rspec', '>= 3.0.0'
|
31
|
+
spec.add_development_dependency 'rubocop'
|
32
|
+
spec.add_development_dependency 'simplecov'
|
33
|
+
end
|