firespring_dev_commands 2.1.13.pre.alpha.3 → 2.1.13

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: 8f84e05f66ceae5becece425cea392a8f1e0bb7e4f6c7f8ef6d6c7bfe068405e
4
- data.tar.gz: 3367ff552bdea261d9612f1a92e10a1f69031e932173ff6e3ae783fa386de968
3
+ metadata.gz: a84986a2061f8fe6b475bc9fbf6b0593abffa358128f97e9fe5e6de67be450ff
4
+ data.tar.gz: 54b7e228c92940a12695a86f1866f2e2c10e382a785004c6d3ad021f79da0fd1
5
5
  SHA512:
6
- metadata.gz: 9bea1ed2293666af0990773ad2a38c9c5fe38d37a17773ab8c256a4bf08560f90d7fe7c1c4ecf3048fb3c3e08e9596a352ab9541ad2f587bb573bfdee97315b9
7
- data.tar.gz: 3a91544429995e944f13fb12e66e969725614d076a23ee50cac2dacab475b04fe6fc0bffd1ae970773b95db2e79c1b800a9ba0892b774c3ec79ac13943c153e2
6
+ metadata.gz: e9233d5fe012349dc028739ff650ef4df1ffba9b8692a5c7141a0db600d10aed51191d9c65f92fadc7a6e4f88240226df815cbac993c4965781440aed09ffd0e
7
+ data.tar.gz: 539dd77c64dc43c8711e5fe2b4f0ad7409b55e1ddf6687aa83372526d3648aa7e7eee8bea6ccee62ac9924201773bbc4addf27f0993eb9b609fe74009833c9d4
@@ -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
@@ -0,0 +1,117 @@
1
+ require 'aws-sdk-lambda'
2
+ require 'aws-sdk-elasticache'
3
+ require 'aws-sdk-rds'
4
+ require 'aws-sdk-opensearchservice'
5
+
6
+ module Dev
7
+ class EndOfLife
8
+ # Class which queries several different AWS product types and
9
+ # returns ProductVersion entities which can be checked for EOL
10
+ class Aws
11
+ # Queries and returns product versions for the default product types
12
+ def default_products
13
+ (elasticache_products + lambda_products + opensearch_products + rds_products).flatten.compact
14
+ end
15
+
16
+ # Queries and returns product versions for elasticache products
17
+ def elasticache_products
18
+ client = ::Aws::ElastiCache::Client.new
19
+
20
+ [].tap do |ary|
21
+ Dev::Aws.each_page(client, :describe_cache_clusters) do |response|
22
+ response.cache_clusters.each do |cluster|
23
+ name = cluster.cache_cluster_id
24
+ product = cluster.engine
25
+ version = cluster.engine_version.reverse.split('.')[-2..].join('.').reverse
26
+ ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ # Queries and returns product versions for lambda products
33
+ def lambda_products
34
+ client = ::Aws::Lambda::Client.new
35
+
36
+ [].tap do |ary|
37
+ Dev::Aws.each_page(client, :list_functions) do |response|
38
+ response.functions.each do |function|
39
+ # Runtime is empty if using a docker image
40
+ next unless function.runtime
41
+
42
+ name = function.function_name
43
+ product = function&.runtime&.split(/[0-9]/, 2)&.first
44
+ version = function&.runtime&.split(/#{product}/, 2)&.last&.chomp('.x')
45
+ ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ # Queries and returns product versions for opensearch products
52
+ def opensearch_products
53
+ client = ::Aws::OpenSearchService::Client.new
54
+
55
+ [].tap do |ary|
56
+ Dev::Aws.each_page(client, :list_domain_names) do |response|
57
+ response.domain_names.each do |domain|
58
+ name = domain.domain_name
59
+ product = domain.engine_type
60
+ version = client.describe_domain(domain_name: name).domain_status.engine_version.split('_').last.split('.').first
61
+ ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
62
+ end
63
+ end
64
+ end
65
+ end
66
+
67
+ # Queries and returns product versions for rds products
68
+ def rds_products
69
+ rds_instance_products + rds_cluster_products
70
+ end
71
+
72
+ # Queries and returns product versions for rds instance products
73
+ def rds_instance_products
74
+ aws_engines = %w(mysql postgresql)
75
+ client = ::Aws::RDS::Client.new
76
+
77
+ [].tap do |ary|
78
+ Dev::Aws.each_page(client, :describe_db_instances) do |response|
79
+ response.db_instances.each do |instance|
80
+ name = instance.db_instance_identifier
81
+ engine = instance.engine.tr('aurora-', '')
82
+ product = if aws_engines.include?(engine)
83
+ "amazon-rds-#{engine}"
84
+ else
85
+ engine
86
+ end
87
+ version = instance.engine_version.reverse.split('.')[-2..].join('.').reverse
88
+ ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
89
+ end
90
+ end
91
+ end
92
+ end
93
+
94
+ # Queries and returns product versions for rds cluster products
95
+ def rds_cluster_products
96
+ aws_engines = %w(mysql postgresql)
97
+ client = ::Aws::RDS::Client.new
98
+
99
+ [].tap do |ary|
100
+ Dev::Aws.each_page(client, :describe_db_clusters) do |response|
101
+ response.db_clusters.each do |cluster|
102
+ name = cluster.db_cluster_identifier
103
+ engine = cluster.engine.tr('aurora-', '')
104
+ product = if aws_engines.include?(engine)
105
+ "amazon-rds-#{engine}"
106
+ else
107
+ engine
108
+ end
109
+ version = cluster.engine_version.reverse.split('.')[-2..].join('.').reverse
110
+ ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
111
+ end
112
+ end
113
+ end
114
+ end
115
+ end
116
+ end
117
+ 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
 
@@ -93,6 +93,25 @@ module Dev
93
93
  end
94
94
  end
95
95
  # rubocop:enable Metrics/MethodLength
96
+
97
+ # Create the rake task for the eol method
98
+ def create_eol_task!
99
+ # Have to set a local variable to be accessible inside of the instance_eval block
100
+ exclude = @exclude
101
+
102
+ DEV_COMMANDS_TOP_LEVEL.instance_eval do
103
+ return if exclude.include?(:eol)
104
+
105
+ desc 'Compares the current date to the EOL date for supported resources'
106
+ task eol: %w(init ensure_aws_credentials) do
107
+ account_id = Dev::Aws::Profile.new.current
108
+ account_name = Dev::Aws::Account.new.name_by_account(account_id)
109
+ LOG.info " Current AWS Account is #{account_name} (#{account_id})".light_yellow
110
+
111
+ Dev::EndOfLife.new(product_versions: Dev::EndOfLife::Aws.new.default_products).check
112
+ end
113
+ end
114
+ end
96
115
  end
97
116
  end
98
117
  end
@@ -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.13.pre.alpha.3'.freeze
9
+ VERSION = '2.1.13'.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.13.pre.alpha.3
4
+ version: 2.1.13
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-13 00:00:00.000000000 Z
11
+ date: 2023-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -66,6 +66,62 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.61.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: aws-sdk-elasticache
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.88.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.88.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: aws-sdk-lambda
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 1.101.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 1.101.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: aws-sdk-opensearchservice
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.24.0
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.24.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: aws-sdk-rds
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.183.0
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.183.0
69
125
  - !ruby/object:Gem::Dependency
70
126
  name: aws-sdk-s3
71
127
  requirement: !ruby/object:Gem::Requirement
@@ -280,6 +336,7 @@ files:
280
336
  - lib/firespring_dev_commands/dotenv.rb
281
337
  - lib/firespring_dev_commands/env.rb
282
338
  - lib/firespring_dev_commands/eol.rb
339
+ - lib/firespring_dev_commands/eol/aws.rb
283
340
  - lib/firespring_dev_commands/eol/product_version.rb
284
341
  - lib/firespring_dev_commands/git.rb
285
342
  - lib/firespring_dev_commands/git/info.rb
@@ -342,9 +399,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
342
399
  version: '3.1'
343
400
  required_rubygems_version: !ruby/object:Gem::Requirement
344
401
  requirements:
345
- - - ">"
402
+ - - ">="
346
403
  - !ruby/object:Gem::Version
347
- version: 1.3.1
404
+ version: '0'
348
405
  requirements: []
349
406
  rubygems_version: 3.4.10
350
407
  signing_key: