cloudformation-tool 1.4.1 → 1.5.0
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b3af98e9eacdd806d05045dca7f8bcf35f6d25c668f8abc2902a45fb07c0ae3
|
4
|
+
data.tar.gz: aedd1156bdd61e9b6085c9496bac440f7fe744b50f5f89319e1386e7043f905e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccb703d5a98b708ceb00ec8e0245b270eb28143066fe14ff86b2c8da03ec2745aac5d588a7b710144d55c5402cd3fe7edf38d9d979b98596ae83e126e38f6338
|
7
|
+
data.tar.gz: 9e063966aa631e161f686ab0af55269a0e8b50cfca6b65f1dc68af7d7e8f9442ce848c7d84106e41c64b33e87e16b8d85a7a65da9c6a3435016f5ef4d43a6a0d
|
@@ -54,8 +54,9 @@ module CloudFormationTool
|
|
54
54
|
subcommand 'delete', "Delete an existing stack", Delete
|
55
55
|
subcommand 'servers', 'List stack resources', Servers
|
56
56
|
subcommand 'groups', 'List stack Autoscaling groups', Groups
|
57
|
+
subcommand 'services', 'List stack Fargate services', Services
|
57
58
|
subcommand 'recycle', 'Recycle servers in an auto scaling group', Recycle
|
58
|
-
subcommand 'scale', 'Set the number of desired
|
59
|
+
subcommand 'scale', 'Set the number of desired servers in an auto scaling group', Scale
|
59
60
|
subcommand 'invalidate', 'Invalidate CloudFront caches in the stack', Invalidate
|
60
61
|
subcommand 'output', 'Retrieve output values from the stack', Output
|
61
62
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module CloudFormationTool
|
2
|
+
module CLI
|
3
|
+
|
4
|
+
class Services < Clamp::Command
|
5
|
+
include CloudFormationTool
|
6
|
+
|
7
|
+
parameter "STACK_NAME", "Name of the stack to list Fargate services from"
|
8
|
+
|
9
|
+
def execute
|
10
|
+
st = CloudFormation::Stack.new(stack_name)
|
11
|
+
output = st.fargate_services.collect do |res|
|
12
|
+
{
|
13
|
+
name: res.logical_resource_id,
|
14
|
+
res: res.physical_resource_id,
|
15
|
+
len: res.logical_resource_id.length
|
16
|
+
}
|
17
|
+
end
|
18
|
+
width = output.collect { |g| g[:name].length }.max
|
19
|
+
output.collect do |svc|
|
20
|
+
puts svc[:name].ljust(width, ' ') + "\t => " + svc[:res]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -126,6 +126,44 @@ module CloudFormationTool
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
+
def fargate_services
|
130
|
+
output = []
|
131
|
+
resources do |res|
|
132
|
+
output << res if res.resource_type == 'AWS::ECS::Service'
|
133
|
+
end
|
134
|
+
output.collect do |res|
|
135
|
+
res.extend(CloudFormationTool)
|
136
|
+
res.instance_eval do
|
137
|
+
def arn
|
138
|
+
physical_resource_id
|
139
|
+
end
|
140
|
+
def cluster_name
|
141
|
+
self.arn.split(/:/).last.split('/')[1]
|
142
|
+
end
|
143
|
+
def service_name
|
144
|
+
self.arn.split(/:/).last.split('/')[2]
|
145
|
+
end
|
146
|
+
def service
|
147
|
+
svc = awsecs.describe_services(cluster: cluster_name, services: [ service_name ], include: [ 'TAGS' ]).services.first
|
148
|
+
svc.instance_eval do
|
149
|
+
def client= ecsclient
|
150
|
+
@client = ecsclient
|
151
|
+
end
|
152
|
+
def client
|
153
|
+
@client
|
154
|
+
end
|
155
|
+
end
|
156
|
+
svc.client = awsecs
|
157
|
+
svc
|
158
|
+
end
|
159
|
+
def task_definition
|
160
|
+
awsecs.describe_task_definition(task_definition: service.task_definition).task_definition
|
161
|
+
end
|
162
|
+
end
|
163
|
+
res
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
129
167
|
def cdns
|
130
168
|
output = []
|
131
169
|
resources do |res|
|
data/lib/cloud_formation_tool.rb
CHANGED
@@ -95,6 +95,11 @@ module CloudFormationTool
|
|
95
95
|
$__aws_as ||= Aws::AutoScaling::Client.new aws_config
|
96
96
|
end
|
97
97
|
|
98
|
+
def awsecs
|
99
|
+
require 'aws-sdk-ecs'
|
100
|
+
$__aws_ecs ||= Aws::ECS::Client.new aws_config
|
101
|
+
end
|
102
|
+
|
98
103
|
def awscdn
|
99
104
|
require 'aws-sdk-cloudfront'
|
100
105
|
$__aws_cdn ||= Aws::CloudFront::Client.new aws_config
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudformation-tool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oded Arbel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: aws-sdk-ecs
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: aws-sdk-autoscaling
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +178,7 @@ files:
|
|
164
178
|
- lib/cloud_formation_tool/cli/recycle.rb
|
165
179
|
- lib/cloud_formation_tool/cli/scale.rb
|
166
180
|
- lib/cloud_formation_tool/cli/servers.rb
|
181
|
+
- lib/cloud_formation_tool/cli/services.rb
|
167
182
|
- lib/cloud_formation_tool/cli/status.rb
|
168
183
|
- lib/cloud_formation_tool/cloud_formation.rb
|
169
184
|
- lib/cloud_formation_tool/cloud_formation/cloud_front_distribution.rb
|
@@ -193,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
208
|
- !ruby/object:Gem::Version
|
194
209
|
version: '0'
|
195
210
|
requirements: []
|
196
|
-
rubygems_version: 3.
|
211
|
+
rubygems_version: 3.2.5
|
197
212
|
signing_key:
|
198
213
|
specification_version: 4
|
199
214
|
summary: A pre-compiler tool for CloudFormation YAML templates
|