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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9db212d7233b62974d4d2b74909f00090561d6dbe874950e580d92d84be67b5f
4
- data.tar.gz: de5bdb35a47c607db653a5befb8f55a82f53dbaca1c28646c00b54be263dd52d
3
+ metadata.gz: 6f4b613a0c93e9ea9f7a8bf871be047d304cd0bca3b74cf0087dd1a108669cab
4
+ data.tar.gz: 7e903e4afbe0b1b634c83182efa9717de20a393a35685aaf18699ec565aee72e
5
5
  SHA512:
6
- metadata.gz: b95c2203787b28ff2abeb5cfe2b54015619c6289a21ef631b8dc8c6c6dbb599600fa9a1113afb99300d6262c8452d41b81e82d117c9a88f98b4fe80ccd67cfd1
7
- data.tar.gz: 3d2178da37d57a8c90a585640e6ed60aa9cafff01c449165c10929fc8c0c362a00b06fbb5c2708c02ef931e565a3368955fc3c3bcaa900f66bc15b21e50dbd20
6
+ metadata.gz: d05f179882ed0090b7e2ab180c91c9ed01bbb101c3a9d169fc9b9ddf6ce1ade2892f8b01b27eaa3d342ddaadb60e797d06e45e91952e20861a498b46c3b72936
7
+ data.tar.gz: 2502e19639d64471221a0693854a5a9bc67e2821284d94ce707dd04d3bb1ea3d0d1a423736ce0538379935ad99b4b27d2bf4a32330d7a56ca6a52666c8d619f2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- aly (0.3.0)
4
+ aly (0.3.3)
5
5
  terminal-table (~> 1.8.0)
6
6
  thor (~> 0.20.0)
7
7
 
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.7.0")
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['detail']
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
- if options['acl']
409
- acl_ids = listeners.flat_map { |listener| listener['AclIds'] || [] }.uniq
410
- unless acl_ids.empty?
411
- alc_entries = acl_ids.flat_map do |acl_id|
412
- attr = exec('slb', 'DescribeAccessControlListAttribute', "--AclId=#{acl_id}", **options)
413
- (attr.dig('AclEntrys', 'AclEntry') || []).each_with_index.map do |e, idx|
414
- {
415
- AclId: (idx.zero? ? attr['AclId'] : ''),
416
- AclName: (idx.zero? ? attr['AclName'] : ''),
417
- AclEntryIP: e['AclEntryIP'],
418
- AclEntryComment: e['AclEntryComment']
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Aly
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.3"
5
5
  end
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.0
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.7.0
91
+ version: 2.5.0
92
92
  required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="