vaws 0.7.0 → 0.8.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/vaws/aws/acm_describer.rb +15 -7
- data/lib/vaws/aws/alb_describer.rb +20 -12
- data/lib/vaws/aws/ec2_describer.rb +29 -20
- data/lib/vaws/aws/ecs_describer.rb +15 -9
- data/lib/vaws/aws/route53_describer.rb +53 -16
- data/lib/vaws/aws/security_group_describer.rb +32 -23
- data/lib/vaws/aws/ssm_describer.rb +17 -10
- data/lib/vaws/aws/subnet_describer.rb +17 -9
- data/lib/vaws/aws/vpc_describer.rb +19 -13
- data/lib/vaws/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1436a9e8759ca8ea7032a05550d72d21047a7b893ce0ba1a8df23530fe0c9d1a
|
4
|
+
data.tar.gz: 3adeb052af24a2646be4369c2ec103af27e46e945474c5da077ba833faab7941
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c64a36363baedb0bc3966447862183ca6ace97ef86a00bfcf6f22fa1b05df57dafe3c82eba49a2c4c0344d644f692140dbf6b725c663c3786b4af0a9ad8c0f1
|
7
|
+
data.tar.gz: 6e8ae8f04ffdc5f1d855a1ffed51e5d3b72cb83188795d83cfc9941deaa94d00596b1ecd26d6e5ca82d2ee2dab720cb28e755c7c50bb06e37f22b4de29ecbd37
|
data/Gemfile.lock
CHANGED
@@ -12,14 +12,22 @@ module Vaws
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def set_basic_info
|
15
|
-
rows
|
16
|
-
|
15
|
+
rows = []
|
16
|
+
next_token = nil
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
begin
|
19
|
+
param_args = {
|
20
|
+
max_items: 1000
|
21
|
+
}
|
22
|
+
param_args[:next_token] = next_token if next_token
|
23
|
+
resp = @acm_client.list_certificates(param_args)
|
24
|
+
resp.certificate_summary_list.each do |cert|
|
25
|
+
cert_arn = cert.certificate_arn
|
26
|
+
cert_domain = cert.domain_name
|
27
|
+
rows << [cert_domain, cert_arn]
|
28
|
+
end
|
29
|
+
next_token = resp.next_token
|
30
|
+
end while next_token
|
23
31
|
@term_table = Terminal::Table.new :headings => ['Domain', 'Arn'], :rows => rows.sort
|
24
32
|
end
|
25
33
|
end
|
@@ -12,20 +12,28 @@ module Vaws
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def set_basic_info
|
15
|
-
rows
|
16
|
-
|
15
|
+
rows = []
|
16
|
+
next_marker = nil
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
vpc = alb.vpc_id
|
25
|
-
type = alb.type
|
18
|
+
begin
|
19
|
+
param_args = {
|
20
|
+
page_size: 400
|
21
|
+
}
|
22
|
+
param_args[:marker] = next_marker if next_marker
|
23
|
+
resp = @alb_client.describe_load_balancers(param_args)
|
26
24
|
|
27
|
-
|
28
|
-
|
25
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/ElasticLoadBalancingV2/Client.html#describe_load_balancers-instance_method
|
26
|
+
resp.load_balancers.each do |alb|
|
27
|
+
arn = alb.load_balancer_arn.sub!(/arn:aws:elasticloadbalancing:ap-northeast-1:163714994724:loadbalancer\/...\//, '')
|
28
|
+
dns = alb.dns_name
|
29
|
+
name = alb.load_balancer_name
|
30
|
+
scheme = alb.scheme
|
31
|
+
vpc = alb.vpc_id
|
32
|
+
type = alb.type
|
33
|
+
rows << [name, type, scheme, vpc, arn, dns]
|
34
|
+
next_marker = resp.next_marker
|
35
|
+
end
|
36
|
+
end while next_marker
|
29
37
|
@term_table = Terminal::Table.new :headings => ['Name', 'Type', 'Scheme', 'Vpc', 'Short_Arn', 'Dns'], :rows => rows.sort
|
30
38
|
end
|
31
39
|
end
|
@@ -13,28 +13,37 @@ module Vaws
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def set_basic_info
|
16
|
-
rows
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
16
|
+
rows = []
|
17
|
+
next_token = nil
|
18
|
+
sg_ids = ""
|
19
|
+
|
20
|
+
begin
|
21
|
+
param_args = {
|
22
|
+
max_results: 1000
|
23
|
+
}
|
24
|
+
param_args[:next_token] = next_token if next_token
|
25
|
+
resp = @ec2_client.describe_instances(param_args)
|
26
|
+
resp[:reservations].each do |reservation|
|
27
|
+
reservation.instances.each do |instance|
|
28
|
+
instance.tags.each do |tag|
|
29
|
+
@tag = tag.value if tag.key == 'Name'
|
30
|
+
end
|
31
|
+
instance.security_groups.each_with_index do |sg, index|
|
32
|
+
sg_ids << "#{sg.group_id}, "
|
33
|
+
sg_ids = sg_ids.gsub(/, $/, '') if index == instance.security_groups.size - 1
|
34
|
+
end
|
35
|
+
instance_id = instance.instance_id
|
36
|
+
instance_type = instance.instance_type
|
37
|
+
public_ip = instance.public_ip_address
|
38
|
+
private_ip = instance.private_ip_address
|
39
|
+
state_name = instance.state.name
|
40
|
+
rows << [@tag, instance_id, instance_type, public_ip, private_ip, state_name, sg_ids]
|
41
|
+
sg_ids = ''
|
27
42
|
end
|
28
|
-
instance_id = ec2_instance.instance_id
|
29
|
-
instance_type = ec2_instance.instance_type
|
30
|
-
public_ip = ec2_instance.public_ip_address
|
31
|
-
private_ip = ec2_instance.private_ip_address
|
32
|
-
state_name = ec2_instance.state.name
|
33
|
-
rows << [@tag, instance_id, instance_type, public_ip, private_ip, state_name, sg_ids]
|
34
|
-
sg_ids = ''
|
35
43
|
end
|
36
|
-
|
37
|
-
|
44
|
+
next_token = resp.next_token
|
45
|
+
end while next_token
|
46
|
+
@term_table = Terminal::Table.new :headings => ['Name', 'Id', 'Type', 'GlobalIp', 'PrivateIp', 'Status', 'SecurityGroupId'], :rows => rows.sort
|
38
47
|
end
|
39
48
|
end
|
40
49
|
end
|
@@ -14,14 +14,13 @@ module Vaws
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def set_basic_info
|
17
|
-
get_cluster_arns
|
18
|
-
|
19
17
|
rows = []
|
20
|
-
|
18
|
+
|
19
|
+
cluster_arns.each do |cluster_arn|
|
21
20
|
cluster_name = cluster_arn.gsub(/arn:aws:ecs:#{ENV['AWS_DEFAULT_REGION']}:[0-9]*:cluster\//, "")
|
22
21
|
@cluster_info.store("#{cluster_name}", {})
|
23
22
|
cluster_name = "#{cluster_name}"
|
24
|
-
cluster_services =
|
23
|
+
cluster_services = service_names(cluster_arn)
|
25
24
|
|
26
25
|
ecs_cluster = @ecs_client.describe_clusters({ clusters: ["#{cluster_arn}"] }).clusters
|
27
26
|
running_tasks_count = ecs_cluster[0].running_tasks_count
|
@@ -36,15 +35,22 @@ module Vaws
|
|
36
35
|
|
37
36
|
private
|
38
37
|
|
39
|
-
def
|
40
|
-
|
38
|
+
def cluster_arns
|
39
|
+
param_args = {
|
40
|
+
max_results: 100
|
41
|
+
}
|
42
|
+
@ecs_client.list_clusters(param_args)[:cluster_arns]
|
41
43
|
end
|
42
44
|
|
43
|
-
def
|
44
|
-
|
45
|
+
def service_arns(cluster_arn)
|
46
|
+
param_args = {
|
47
|
+
cluster: cluster_arn,
|
48
|
+
max_results: 1
|
49
|
+
}
|
50
|
+
@ecs_client.list_services(param_args)[:service_arns]
|
45
51
|
end
|
46
52
|
|
47
|
-
def
|
53
|
+
def service_names(cluster_arn)
|
48
54
|
service_ary = @ecs_client.list_services({ cluster: "#{cluster_arn}", max_results: 100 })[:service_arns].sort
|
49
55
|
service_ary.join("\n").gsub(/arn:aws:ecs:#{ENV['AWS_DEFAULT_REGION']}:[0-9]*:service\//, "")
|
50
56
|
end
|
@@ -14,33 +14,70 @@ module Vaws
|
|
14
14
|
|
15
15
|
def set_basic_info
|
16
16
|
rows = []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
17
|
+
|
18
|
+
zone_id = selected_zone_id
|
19
|
+
record_values = ''
|
20
|
+
next_record_identifier = nil
|
21
|
+
next_record_name = nil
|
22
|
+
next_record_type = nil
|
23
|
+
|
24
|
+
begin
|
25
|
+
param_args = {
|
26
|
+
hosted_zone_id: zone_id,
|
27
|
+
max_items: 200
|
28
|
+
}
|
29
|
+
param_args[:start_record_identifier] = next_record_identifier if next_record_identifier
|
30
|
+
param_args[:start_record_name] = next_record_name if next_record_name
|
31
|
+
param_args[:start_record_type] = next_record_type if next_record_type
|
32
|
+
resp = @r53_client.list_resource_record_sets(param_args)
|
33
|
+
|
34
|
+
resp.resource_record_sets.each do |record_set|
|
35
|
+
name = record_set.name
|
36
|
+
type = record_set.type
|
37
|
+
ttl = record_set.ttl
|
38
|
+
if record_set.alias_target.nil?
|
39
|
+
record_set.resource_records.each do |record|
|
28
40
|
record_values << "#{record.value.to_s}\n"
|
29
41
|
end
|
30
42
|
else
|
31
|
-
record_values =
|
43
|
+
record_values = record_set.alias_target.dns_name
|
32
44
|
end
|
33
|
-
rows << [
|
45
|
+
rows << [name, type, record_values, ttl]
|
34
46
|
record_values = ''
|
35
47
|
end
|
36
|
-
|
48
|
+
next_record_identifier = resp.next_record_identifier
|
49
|
+
next_record_name = resp.next_record_name
|
50
|
+
next_record_type = resp.next_record_type
|
51
|
+
end while next_record_identifier
|
37
52
|
@term_table = Terminal::Table.new :headings => ['Fqdn', 'Type', 'Value', 'Ttl'], :rows => rows.sort
|
38
53
|
end
|
39
54
|
|
55
|
+
|
40
56
|
private
|
41
57
|
|
42
|
-
def
|
43
|
-
|
58
|
+
def selected_zone_id
|
59
|
+
puts "# ZONE LIST"
|
60
|
+
zones = hosted_zones
|
61
|
+
zones.each_with_index do |zone, cnt|
|
62
|
+
puts "#{cnt}:#{zone[:name]}"
|
63
|
+
end
|
64
|
+
print "zone number: "
|
65
|
+
input = STDIN.gets
|
66
|
+
begin
|
67
|
+
raise unless /[0-9].*/ =~ input
|
68
|
+
input_zone_number = input.to_i
|
69
|
+
zones[input_zone_number][:id] if zones[input_zone_number][:id]
|
70
|
+
rescue
|
71
|
+
puts "Not found zone"
|
72
|
+
return
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def hosted_zones
|
77
|
+
param_args = {
|
78
|
+
max_items: 100
|
79
|
+
}
|
80
|
+
@r53_client.list_hosted_zones(param_args).hosted_zones.each do |zone|
|
44
81
|
@r53_hosted_zone_ids << zone.id
|
45
82
|
end
|
46
83
|
end
|
@@ -13,33 +13,42 @@ module Vaws
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def set_basic_info
|
16
|
-
rows
|
17
|
-
|
18
|
-
resp_sg.security_groups.each do |security_group|
|
19
|
-
group_name = security_group.group_name
|
20
|
-
group_id = security_group.group_id
|
16
|
+
rows = []
|
17
|
+
next_token = nil
|
21
18
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
begin
|
20
|
+
param_args = {
|
21
|
+
max_results: 100
|
22
|
+
}
|
23
|
+
param_args[:next_token] = next_token if next_token
|
24
|
+
resp = @ec2_client.describe_security_groups(param_args)
|
25
|
+
resp.security_groups.each do |security_group|
|
26
|
+
group_name = security_group.group_name
|
27
|
+
group_id = security_group.group_id
|
26
28
|
|
27
|
-
#
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
29
|
+
# Inboundルール
|
30
|
+
security_group.ip_permissions.each do |ip_permission|
|
31
|
+
ip_permission.from_port.nil? ? from_port = "all" : from_port = ip_permission.from_port.to_s
|
32
|
+
ip_permission.ip_protocol == "-1" ? ip_protocol = "all" : ip_protocol = ip_permission.ip_protocol
|
33
|
+
|
34
|
+
# セキュリティグループによるルール
|
35
|
+
ip_permission.user_id_group_pairs.each do |user_id_group_pair|
|
36
|
+
cidr_ip = user_id_group_pair.group_id
|
37
|
+
rows << [group_name, group_id, "#{cidr_ip}:#{from_port}", ip_protocol]
|
38
|
+
group_name = ''
|
39
|
+
group_id = ''
|
40
|
+
end
|
41
|
+
# IPアドレスによるルール
|
42
|
+
ip_permission.ip_ranges.each do |ip_range|
|
43
|
+
cidr_ip = ip_range.cidr_ip
|
44
|
+
rows << [group_name, group_id, "#{cidr_ip}:#{from_port}", ip_protocol]
|
45
|
+
group_name = ''
|
46
|
+
group_id = ''
|
47
|
+
end
|
40
48
|
end
|
41
49
|
end
|
42
|
-
|
50
|
+
next_token = resp.next_token
|
51
|
+
end while next_token
|
43
52
|
@term_table = Terminal::Table.new :headings => ['Name', 'Id', 'Inbound(Cidr|Securitygroup:Port)', 'Protocol'], :rows => rows
|
44
53
|
end
|
45
54
|
end
|
@@ -12,17 +12,24 @@ module Vaws
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def set_basic_info
|
15
|
-
rows
|
16
|
-
|
15
|
+
rows = []
|
16
|
+
next_token = nil
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
begin
|
19
|
+
param_args = {
|
20
|
+
max_results: 100
|
21
|
+
}
|
22
|
+
param_args[:next_token] = next_token if next_token
|
23
|
+
resp = @ssm_client.describe_parameters(param_args)
|
24
|
+
resp.parameters.each do |param|
|
25
|
+
name = param.name
|
26
|
+
type = param.type
|
27
|
+
version = param.version
|
28
|
+
last_modify_date = param.last_modified_date
|
29
|
+
rows << [name, type, version, last_modify_date]
|
30
|
+
end
|
31
|
+
next_token = resp.next_token
|
32
|
+
end while next_token
|
26
33
|
@term_table = Terminal::Table.new :headings => ['Path', 'Type', 'Version', 'LastModifyDate'], :rows => rows.sort
|
27
34
|
end
|
28
35
|
end
|
@@ -12,16 +12,24 @@ module Vaws
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def set_basic_info
|
15
|
-
rows
|
16
|
-
|
17
|
-
subnets.subnets.each do |subnet|
|
18
|
-
az = subnet.availability_zone
|
19
|
-
cidr = subnet.cidr_block
|
20
|
-
subnet_id = subnet.subnet_id
|
21
|
-
vpc_id = subnet.vpc_id
|
15
|
+
rows = []
|
16
|
+
next_token = nil
|
22
17
|
|
23
|
-
|
24
|
-
|
18
|
+
begin
|
19
|
+
param_args = {
|
20
|
+
max_results: 100
|
21
|
+
}
|
22
|
+
param_args[:next_token] = next_token if next_token
|
23
|
+
resp = @subnet_client.describe_subnets(param_args)
|
24
|
+
resp.subnets.each do |subnet|
|
25
|
+
az = subnet.availability_zone
|
26
|
+
cidr = subnet.cidr_block
|
27
|
+
subnet_id = subnet.subnet_id
|
28
|
+
vpc_id = subnet.vpc_id
|
29
|
+
rows << [cidr, subnet_id, az, vpc_id]
|
30
|
+
end
|
31
|
+
next_token = resp.next_token
|
32
|
+
end while next_token
|
25
33
|
@term_table = Terminal::Table.new :headings => ['Cidr', 'SubnetId', 'Az', 'VpcId'], :rows => rows.sort
|
26
34
|
end
|
27
35
|
end
|
@@ -12,21 +12,27 @@ module Vaws
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def set_basic_info
|
15
|
-
rows
|
16
|
-
|
15
|
+
rows = []
|
16
|
+
next_token = nil
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
begin
|
19
|
+
param_args = {
|
20
|
+
max_results: 100
|
21
|
+
}
|
22
|
+
param_args[:next_token] = next_token if next_token
|
23
|
+
resp = @vpc_client.describe_vpcs(param_args)
|
24
|
+
resp.vpcs.each do |vpc|
|
25
|
+
cidr = vpc.cidr_block
|
26
|
+
vpc_id = vpc.vpc_id
|
27
|
+
tags = ''
|
28
|
+
vpc.tags.each_with_index do |tag, index|
|
29
|
+
tags << "#{tag.value}, "
|
30
|
+
tags = tags.gsub(/, $/, '') if index == vpc.tags.size - 1
|
31
|
+
end
|
32
|
+
rows << [vpc_id, cidr, tags]
|
26
33
|
end
|
27
|
-
|
28
|
-
|
29
|
-
end
|
34
|
+
next_token = resp.next_token
|
35
|
+
end while next_token
|
30
36
|
@term_table = Terminal::Table.new :headings => ['VpcId', 'Cidr', 'Tags'], :rows => rows.sort
|
31
37
|
end
|
32
38
|
end
|
data/lib/vaws/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vaws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shota Ito
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -220,8 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
220
|
- !ruby/object:Gem::Version
|
221
221
|
version: '0'
|
222
222
|
requirements: []
|
223
|
-
|
224
|
-
rubygems_version: 2.7.6.2
|
223
|
+
rubygems_version: 3.1.2
|
225
224
|
signing_key:
|
226
225
|
specification_version: 4
|
227
226
|
summary: The vaws command simplifies the display of AWS resources.
|