aly 0.3.0 → 0.3.3
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/Gemfile.lock +1 -1
- data/aly.gemspec +1 -1
- data/lib/aly/app.rb +31 -20
- data/lib/aly/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f4b613a0c93e9ea9f7a8bf871be047d304cd0bca3b74cf0087dd1a108669cab
|
|
4
|
+
data.tar.gz: 7e903e4afbe0b1b634c83182efa9717de20a393a35685aaf18699ec565aee72e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d05f179882ed0090b7e2ab180c91c9ed01bbb101c3a9d169fc9b9ddf6ce1ade2892f8b01b27eaa3d342ddaadb60e797d06e45e91952e20861a498b46c3b72936
|
|
7
|
+
data.tar.gz: 2502e19639d64471221a0693854a5a9bc67e2821284d94ce707dd04d3bb1ea3d0d1a423736ce0538379935ad99b4b27d2bf4a32330d7a56ca6a52666c8d619f2
|
data/Gemfile.lock
CHANGED
data/aly.gemspec
CHANGED
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
|
12
12
|
spec.description = "A simple wrapper for aliyun cli"
|
|
13
13
|
spec.homepage = "https://github.com/lululau/aly"
|
|
14
14
|
spec.license = "MIT"
|
|
15
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
|
16
16
|
|
|
17
17
|
# Specify which files should be added to the gem when it is released.
|
|
18
18
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
data/lib/aly/app.rb
CHANGED
|
@@ -35,7 +35,20 @@ module Aly
|
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
if options['
|
|
38
|
+
if options['full']
|
|
39
|
+
selected = selected.map do |row|
|
|
40
|
+
{
|
|
41
|
+
Id: row['InstanceId'],
|
|
42
|
+
Name: row['InstanceName'],
|
|
43
|
+
PrivateIP: row['PrivateIP'],
|
|
44
|
+
PublicIP: row['PublicIP'],
|
|
45
|
+
CPU: row['Cpu'],
|
|
46
|
+
RAM: "#{row['Memory'] / 1024.0} GB",
|
|
47
|
+
WEB: "https://ecs.console.aliyun.com/#/server/#{row['InstanceId']}/monitor?regionId=#{row['RegionId']}"
|
|
48
|
+
}
|
|
49
|
+
end
|
|
50
|
+
puts selected.table&.to_s
|
|
51
|
+
elsif options['detail']
|
|
39
52
|
puts JSON.pretty_generate(selected)
|
|
40
53
|
else
|
|
41
54
|
selected = selected.map do |row|
|
|
@@ -104,7 +117,8 @@ module Aly
|
|
|
104
117
|
Name: lb['LoadBalancerName'],
|
|
105
118
|
Address: lb['Address'],
|
|
106
119
|
Eip: lb['Eip'],
|
|
107
|
-
Listeners: listeners.size
|
|
120
|
+
Listeners: listeners.size,
|
|
121
|
+
WEB: "https://slb.console.aliyun.com/slb/#{lb['RegionId']}/slbs/#{lb['LoadBalancerId']}/listeners"
|
|
108
122
|
}].table.to_s.gsub(/^/, ' '))
|
|
109
123
|
puts
|
|
110
124
|
|
|
@@ -405,25 +419,22 @@ module Aly
|
|
|
405
419
|
puts listener_rules.table.to_s.gsub(/^/, ' ')
|
|
406
420
|
puts
|
|
407
421
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
end + [nil]
|
|
421
|
-
end
|
|
422
|
-
puts ' Access Control Lists:'
|
|
423
|
-
puts alc_entries[0..-2].table.to_s.gsub(/^/, ' ')
|
|
424
|
-
puts
|
|
422
|
+
acl_ids = listeners.flat_map { |listener| listener['AclIds'] || [] }.uniq
|
|
423
|
+
unless acl_ids.empty?
|
|
424
|
+
alc_entries = acl_ids.flat_map do |acl_id|
|
|
425
|
+
attr = exec('slb', 'DescribeAccessControlListAttribute', "--AclId=#{acl_id}", **options)
|
|
426
|
+
(attr.dig('AclEntrys', 'AclEntry') || []).each_with_index.map do |e, idx|
|
|
427
|
+
{
|
|
428
|
+
AclId: (idx.zero? ? attr['AclId'] : ''),
|
|
429
|
+
AclName: (idx.zero? ? attr['AclName'] : ''),
|
|
430
|
+
AclEntryIP: e['AclEntryIP'],
|
|
431
|
+
AclEntryComment: e['AclEntryComment']
|
|
432
|
+
}
|
|
433
|
+
end + [nil]
|
|
425
434
|
end
|
|
426
|
-
|
|
435
|
+
puts ' Access Control Lists:'
|
|
436
|
+
puts alc_entries[0..-2].table.to_s.gsub(/^/, ' ')
|
|
437
|
+
puts
|
|
427
438
|
end
|
|
428
439
|
end
|
|
429
440
|
|
data/lib/aly/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: aly
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Liu Xiang
|
|
@@ -88,7 +88,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
88
88
|
requirements:
|
|
89
89
|
- - ">="
|
|
90
90
|
- !ruby/object:Gem::Version
|
|
91
|
-
version: 2.
|
|
91
|
+
version: 2.5.0
|
|
92
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
94
|
- - ">="
|