firespring_dev_commands 2.1.12.pre.alpha.1 → 2.1.12.pre.alpha.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d45e522585dc1fc678c904d007d74a62e7dcf144ce7740a16d65d74f733f9b3
4
- data.tar.gz: 921bf69588ec64e831c6ddff866185cb639d0567dbd046cbd3109c451475d349
3
+ metadata.gz: f8993e41d585b29c955ea70b4dfae9a5c872cf86178187b9cde5ba1f081c3670
4
+ data.tar.gz: ce445cfe3aa1cb61ccf839041c82e4300671721f60e7c68d4df63a4042c06b8b
5
5
  SHA512:
6
- metadata.gz: d3b1641933384538aba3ad31a5b7e06bea40a28b1388567ea5d8818488860097b2d465d84fb2259d1c5f1214fece78f3ceb4cb21dba1c5e8c46e266661bd7cbe
7
- data.tar.gz: c4e70e99aaf81fbb35c60b07178fcf1fbbfa9a2fe1e7636c6b53541c9920122f382f43787c13fc9a6272784ccb0a3aa4772ac4529c2dbe2437406f90dc4fb167
6
+ metadata.gz: 2bfbf558bae2b57fff698f64219dba7e3e3c1dda9dd4876bb36668758653ab35d4bb305700e0da7ea3df50181b950f077167361a9724c761a039feb0e83be65a
7
+ data.tar.gz: 538965a55936c9b000a23b911a5b9cad7a50f0d005e94329281ad5e2ca9f43b807b08435813e75f240a37289cc2b5f545f223a52155bedfd4bfbe8d487bcb45d
@@ -21,16 +21,10 @@ module Dev
21
21
  def pipelines(regex_match = nil)
22
22
  raise 'regex_match must be a regexp' if regex_match && !regex_match.is_a?(Regexp)
23
23
 
24
- params = {}
25
- response = client.list_pipelines(params)
26
- pipelines = response.pipelines
27
-
28
- next_token = response.next_token
29
- while next_token
30
- params[:next_token] = next_token
31
- response = client.list_pipelines(params)
32
- pipelines += response.pipelines
33
- next_token = response.next_token
24
+ pipelines = [].tap do |ary|
25
+ Dev::Aws.each_page(client, :list_pipelines) do |response|
26
+ ary.concat(response.pipelines)
27
+ end
34
28
  end
35
29
 
36
30
  pipelines.select! { |it| it.name.match(regex_match) } if regex_match
@@ -24,20 +24,12 @@ module Dev
24
24
 
25
25
  # Retrieve all parameters which start with the given path
26
26
  def list(path, recursive: true, with_decryption: true)
27
- next_token = nil
28
-
29
- parameters = []
30
- loop do
31
- response = client.get_parameters_by_path(
32
- path:,
33
- recursive:,
34
- with_decryption:,
35
- next_token:
36
- )
37
- parameters += response.parameters
38
- break unless (next_token = response.next_token)
27
+ [].tap do |ary|
28
+ params = {path:, recursive:, with_decryption:}
29
+ Dev::Aws.each_page(client, :get_parameters_by_path, params) do |response|
30
+ ary.concat(response.parameters)
31
+ end
39
32
  end
40
- parameters
41
33
  end
42
34
 
43
35
  # Sets the given parameter name's value to the given value
@@ -9,5 +9,17 @@ module Dev
9
9
 
10
10
  # The default role name used if none has been configured when logging in
11
11
  DEFAULT_LOGIN_ROLE_NAME = 'ReadonlyAccessRole'.freeze
12
+
13
+ # Runs the query on the client with the parameters
14
+ # Yields each response page
15
+ def self.each_page(client, query, params = {})
16
+ response = client.send(query, params)
17
+ yield response
18
+
19
+ while response.next_page?
20
+ response = response.next_page
21
+ yield response
22
+ end
23
+ end
12
24
  end
13
25
  end
@@ -8,57 +8,97 @@ module Dev
8
8
  class Aws
9
9
  def elasticache_products
10
10
  client = ::Aws::ElastiCache::Client.new
11
- client.describe_cache_clusters.cache_clusters.filter_map do |cluster|
12
- name = cluster.cache_cluster_id
13
- product = cluster.engine
14
- version = cluster.engine_version.reverse.split('.')[-2..].join('.').reverse
15
- Dev::EndOfLife::ProductVersion.new(product, version, name)
11
+
12
+ [].tap do |ary|
13
+ Dev::Aws.each_page(client, :describe_cache_clusters) do |response|
14
+ response.cache_clusters.each do |cluster|
15
+ name = cluster.cache_cluster_id
16
+ product = cluster.engine
17
+ version = cluster.engine_version.reverse.split('.')[-2..].join('.').reverse
18
+ ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
19
+ end
20
+ end
16
21
  end
17
22
  end
18
23
 
19
24
  def lambda_products
20
25
  client = ::Aws::Lambda::Client.new
21
- client.list_functions.functions.filter_map do |function|
22
- # Runtime is empty if using a docker image
23
- next unless function.runtime
24
26
 
25
- name = function.function_name
26
- product = function.runtime.split(/[0-9]/, 2).first
27
- version = function.runtime.split(/#{product}/, 2).last.chomp('.x')
28
- Dev::EndOfLife::ProductVersion.new(product, version, name)
27
+ [].tap do |ary|
28
+ Dev::Aws.each_page(client, :list_functions) do |response|
29
+ response.functions.each do |function|
30
+ # Runtime is empty if using a docker image
31
+ # TODO Should we still handle this case?
32
+ next unless function.runtime
33
+
34
+ name = function.function_name
35
+ product = function&.runtime&.split(/[0-9]/, 2)&.first
36
+ version = function&.runtime&.split(/#{product}/, 2)&.last&.chomp('.x')
37
+ ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
38
+ end
39
+ end
29
40
  end
30
41
  end
31
42
 
32
43
  def opensearch_products
33
44
  client = ::Aws::OpenSearchService::Client.new
34
- client.list_domain_names.domain_names.filter_map do |domain|
35
- name = domain.domain_name
36
- product = domain.engine_type
37
- version = client.describe_domain(domain_name: name).domain_status.engine_version.split('_').last.split('.').first
38
- Dev::EndOfLife::ProductVersion.new(product, version, name)
45
+
46
+ [].tap do |ary|
47
+ Dev::Aws.each_page(client, :list_domain_names) do |response|
48
+ response.domain_names.each do |domain|
49
+ name = domain.domain_name
50
+ product = domain.engine_type
51
+ version = client.describe_domain(domain_name: name).domain_status.engine_version.split('_').last.split('.').first
52
+ ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
53
+ end
54
+ end
39
55
  end
40
56
  end
41
57
 
42
58
  def rds_products
43
- supported_aws_engines = %w(mysql postgresql)
44
- supported_eol_engines = %w(mssqlserver mysql postgresql sqlite)
59
+ _rds_instances + _rds_clusters
60
+ end
45
61
 
62
+ def _rds_instances
63
+ aws_engines = %w(mysql postgresql)
46
64
  client = ::Aws::RDS::Client.new
47
- client.describe_db_instances.db_instances.filter_map do |instance|
48
- name = instance.db_instance_identifier
49
- product = if supported_aws_engines.include?(instance.engine)
50
- "amazon-rds-#{instance.engine}"
51
- elsif supported_eol_engines.include?(instance.engine)
52
- instance.engine
53
- else
54
- puts "WARNING: unsupported engine #{instance.engine} found".light_yellow
55
- next
56
- end
57
- version = instance.engine_version.reverse.split('.')[-2..].join('.').reverse
58
- Dev::EndOfLife::ProductVersion.new(product, version, name)
65
+
66
+ [].tap do |ary|
67
+ Dev::Aws.each_page(client, :describe_db_instances) do |response|
68
+ response.db_instances.each do |instance|
69
+ name = instance.db_instance_identifier
70
+ engine = instance.engine.tr('aurora-', '')
71
+ product = if aws_engines.include?(engine)
72
+ "amazon-rds-#{engine}"
73
+ else
74
+ engine
75
+ end
76
+ version = instance.engine_version.reverse.split('.')[-2..].join('.').reverse
77
+ ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
78
+ end
79
+ end
59
80
  end
81
+ end
82
+
83
+ def _rds_clusters
84
+ aws_engines = %w(mysql postgresql)
85
+ client = ::Aws::RDS::Client.new
60
86
 
61
- # TODO: Add db cluster info too?
87
+ [].tap do |ary|
88
+ Dev::Aws.each_page(client, :describe_db_clusters) do |response|
89
+ response.db_clusters.each do |cluster|
90
+ name = cluster.db_cluster_identifier
91
+ engine = cluster.engine.tr('aurora-', '')
92
+ product = if aws_engines.include?(engine)
93
+ "amazon-rds-#{engine}"
94
+ else
95
+ engine
96
+ end
97
+ version = cluster.engine_version.reverse.split('.')[-2..].join('.').reverse
98
+ ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
99
+ end
100
+ end
101
+ end
62
102
  end
63
103
  end
64
104
  end
@@ -55,9 +55,7 @@ module Dev
55
55
  # If EOL info is a boolean or missing from the current details, overwrite with the manual date (if present)
56
56
  manual_date = Dev::EndOfLife.config.manual_dates["#{product}_#{cycle.tr('.', '_')}".to_sym]
57
57
  detail['eol'] = manual_date if manual_date && (detail['eol'].boolean? || detail['eol'].nil?)
58
-
59
- raise "unable to query eol detail for #{name}, #{cycle}" if detail.empty?
60
-
58
+ detail['eol'] = '1979-01-01' if detail.empty?
61
59
  detail
62
60
  end
63
61
 
@@ -6,6 +6,6 @@ module Dev
6
6
  # Use 'v.v.v.pre.alpha.v' for pre-release vesions
7
7
  # Use 'v.v.v.beta.v for beta versions
8
8
  # Use semantic versioning for any releases (https://semver.org/)
9
- VERSION = '2.1.12.pre.alpha.1'.freeze
9
+ VERSION = '2.1.12.pre.alpha.2'.freeze
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firespring_dev_commands
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.12.pre.alpha.1
4
+ version: 2.1.12.pre.alpha.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firespring
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-09 00:00:00.000000000 Z
11
+ date: 2023-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport