lsaws 0.3.0 → 0.3.1

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: fc348c9f2fd3c7a4f3159329804809b7800307aa42eedfdc01b17d9c8e220021
4
- data.tar.gz: b558293f705f7df368d75aeb41a6bc133fd7bb3a366ddef2f790f99267c019c5
3
+ metadata.gz: e2b87621670d3747c4c1b6cb9979c7401f7e736ceb8c257819a42dc31b190471
4
+ data.tar.gz: ab3227e58e62f14a718858242bd2cdd5ffd8f6a5f15acc38550605a01aea2352
5
5
  SHA512:
6
- metadata.gz: 2c2a9d0c17689697c13aa3be30e05b6406a7d0031102342e3bddfcd56a486b73e23c57cdfcae8fa9653443e66fefb8b5d962c57abd044f103ecf26e85a69d7a4
7
- data.tar.gz: 2dc1db342c3d646d9b5e7504b01cf2fdd9f83ad9e90298bde50f69eaf9b5adffce0405a0b8b86ea7890617fb484262780397a9ee08bb0e43a9a652d22d8672e8
6
+ metadata.gz: 4eeb107b1267e40dadb27fccb5dc619f53807410c68c3b85cda9c5e63e3c57da9ab731b422f1c236a0b3bc7a2701e4bffee989257676a9e3cff20cfc9ce2b07c
7
+ data.tar.gz: a725ba9efec0bf251516ca30a8841dac825ca3dacaf2adf00dcef453f2806e22d946512a6b4f6e70bb6f72547f2204e474065f623f86bc258e0a48624c8e9aef
data/README.md CHANGED
@@ -23,6 +23,88 @@ User-friendly AWS resources listing tool
23
23
  -A, --all List all entity types within SDK
24
24
 
25
25
 
26
+ ### Listing installed SDKs
27
+
28
+ # lsaws -L
29
+
30
+ accessanalyzer
31
+ account
32
+ acm
33
+ acmpca
34
+ alexaforbusiness
35
+ amplify
36
+ amplifybackend
37
+ amplifyuibuilder
38
+ apigateway
39
+ apigatewaymanagementapi
40
+ apigatewayv2
41
+ appconfig
42
+ appconfigdata
43
+ appflow
44
+ appintegrationsservice
45
+ applicationautoscaling
46
+ applicationcostprofiler
47
+ applicationdiscoveryservice
48
+ applicationinsights
49
+ appmesh
50
+ appregistry
51
+ apprunner
52
+ appstream
53
+ appsync
54
+ arczonalshift
55
+ ...
56
+
57
+
58
+ ### Listing listable entities from EC2 sdk
59
+
60
+ # lsaws ec2 -L
61
+
62
+ account_attributes
63
+ address_transfers
64
+ addresses
65
+ availability_zones
66
+ aws_network_performance_metric_subscriptions
67
+ bundle_tasks
68
+ capacity_reservation_fleets
69
+ capacity_reservations
70
+ carrier_gateways
71
+ classic_link_instances
72
+ client_vpn_endpoints
73
+ coip_pools
74
+ conversion_tasks
75
+ customer_gateways
76
+ dhcp_options
77
+ egress_only_internet_gateways
78
+ elastic_gpus
79
+ export_image_tasks
80
+ export_tasks
81
+ fast_launch_images
82
+ fast_snapshot_restores
83
+ fleets
84
+ flow_logs
85
+ fpga_images
86
+ host_reservation_offerings
87
+ ...
88
+
89
+
90
+ ### Listing EC2 instances
91
+
92
+ # lsaws ec2
93
+
94
+ ┌─────────────────────┬─────────────┬───────────────────────┬────────────────────┬─────────────────────────┐
95
+ │ instance_id │ name │ vpc_id │ private_ip_address │ launch_time │
96
+ ├─────────────────────┼─────────────┼───────────────────────┼────────────────────┼─────────────────────────┤
97
+ │ i-1234567890abcdef0 │ my-instance │ vpc-1234567890abcdef0 │ 10-0-0-157 │ 2022-11-15 10:48:59 UTC │
98
+ └─────────────────────┴─────────────┴───────────────────────┴────────────────────┴─────────────────────────┘
99
+
100
+ ### Listing specific columns of EC2 images as json-stream
101
+
102
+ # lsaws ec2 images -c image_id,creation_date -o js
103
+
104
+ {"image_id":"ami-1234e6197567838b4","creation_date":"2023-01-11T13:02:00.000Z"}
105
+ {"image_id":"ami-1234f58a167898416","creation_date":"2023-01-11T02:02:00.000Z"}
106
+ {"image_id":"ami-12341a1fd567897a8","creation_date":"2023-01-01T01:02:00.000Z"}
107
+
26
108
  ## License
27
109
 
28
110
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/README.md.tpl CHANGED
@@ -6,6 +6,32 @@ User-friendly AWS resources listing tool
6
6
 
7
7
  % lsaws
8
8
 
9
+ ### Listing installed SDKs
10
+
11
+ % lsaws -L
12
+
13
+ ### Listing listable entities from EC2 sdk
14
+
15
+ % lsaws ec2 -L
16
+
17
+ ### Listing EC2 instances
18
+
19
+ # lsaws ec2
20
+
21
+ ┌─────────────────────┬─────────────┬───────────────────────┬────────────────────┬─────────────────────────┐
22
+ │ instance_id │ name │ vpc_id │ private_ip_address │ launch_time │
23
+ ├─────────────────────┼─────────────┼───────────────────────┼────────────────────┼─────────────────────────┤
24
+ │ i-1234567890abcdef0 │ my-instance │ vpc-1234567890abcdef0 │ 10-0-0-157 │ 2022-11-15 10:48:59 UTC │
25
+ └─────────────────────┴─────────────┴───────────────────────┴────────────────────┴─────────────────────────┘
26
+
27
+ ### Listing specific columns of EC2 images as json-stream
28
+
29
+ # lsaws ec2 images -c image_id,creation_date -o js
30
+
31
+ {"image_id":"ami-0245e6197bf3138b4","creation_date":"2023-01-19T12:03:38.000Z"}
32
+ {"image_id":"ami-0bc3f58a172118416","creation_date":"2023-01-20T09:37:32.000Z"}
33
+ {"image_id":"ami-07e71a1fdf49957a8","creation_date":"2023-02-01T02:06:29.000Z"}
34
+
9
35
  ## License
10
36
 
11
37
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/lib/lsaws/lister.rb CHANGED
@@ -15,6 +15,17 @@ module Lsaws
15
15
  @options[:max_width] = nil if @options[:max_width].to_i.zero?
16
16
  end
17
17
 
18
+ def _abort_with_list(sdk, type)
19
+ if type == "default"
20
+ warn "[!] no default entity type set for #{sdk.inspect} SDK"
21
+ else
22
+ warn "[!] #{sdk.inspect} SDK does not have #{type.inspect} entity type"
23
+ end
24
+ puts "Known entity types are:"
25
+ list_entity_types(sdk)
26
+ exit 1
27
+ end
28
+
18
29
  def _prepare_entities(sdk, type, &block)
19
30
  edef = Lsaws.config.dig(sdk, type)
20
31
  return _prepare_entities(sdk, edef, &block) if edef.is_a?(String) # redirect like 'default' -> 'instances'
@@ -34,16 +45,7 @@ module Lsaws
34
45
  client_class = edef["client_class"] || sdkp.client_class_name
35
46
  client = Kernel.const_get(client_class).new
36
47
  method_name = edef["method"] || sdkp.etype2method(type)
37
- unless client.respond_to?(method_name)
38
- if type == "default"
39
- warn "[!] no default entity type set for #{sdk.inspect} SDK"
40
- else
41
- warn "[!] #{sdk.inspect} SDK does not have #{type.inspect} entity type"
42
- end
43
- puts "Known entity types are:"
44
- list_entity_types(sdk)
45
- exit 1
46
- end
48
+ _abort_with_list(sdk, type) unless method_name
47
49
  warn "[d] #{method_name} #{params}" if @options[:debug]
48
50
  results = client.send(method_name, params)
49
51
 
@@ -68,7 +68,7 @@ module Lsaws
68
68
  required_params.any? || Lsaws.config.dig(@sdk, method2etype(m), "required_params")
69
69
  end
70
70
 
71
- methods.map { |m| method2etype(m) }.sort
71
+ methods.map { |m| method2etype(m) }.uniq.sort
72
72
  end
73
73
 
74
74
  def get_method_rdoc(method)
data/lib/lsaws/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lsaws
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lsaws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey "Zed" Zaikin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-12 00:00:00.000000000 Z
11
+ date: 2023-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core