firespring_dev_commands 2.1.32.pre.alpha.0 → 2.1.32.pre.alpha.2

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: 288c13e632766bcc695d3acc7991a25fa566d943d1297be1af0744daad47f827
4
- data.tar.gz: aec2fcbe07d4e10ef2de90a7937a7b6c48d741e321c7f4b89926a4799400a4a9
3
+ metadata.gz: 41b024ecb06f97d872f8a5b83ca9afb7af3fc92cae13e91674ff72812d920c68
4
+ data.tar.gz: fbbc7b27d086c5734a3041c6a43033e7b654e9486aac0280655fd70da25e75c8
5
5
  SHA512:
6
- metadata.gz: 67b9ed3827875c7607de46ad05e75d6b3d83036c413bb7545caff7cccd48f2a5e5a2204ae368f019be08dd9a01bc0a1b6829b15a12ab8926887fcf61671d12e7
7
- data.tar.gz: 0dbeb26c9a792c84b74ef074cf12498b478089ed3933781193f77f479140810b167ef6450cdc252073de0dfe9877204e6c092796b320fb0add7db3b5dad088d7
6
+ metadata.gz: 80e32906a5e5e5aa84fd2c985636327a7068fe7b75c8e94fbbe5a85bb78d0c0d239acef5f0dfa2b95299e201940898e2517b3337f966d059db15949eecaf61bc
7
+ data.tar.gz: 5284e5c970113eff3d78d8c86e3ae8adb6f0d54c5fe0d82a1fff6225f9cdd0a50093af41af315a1b4234d950f0ec47c1d1910562afbca7e5d790246c4e12105d
@@ -8,20 +8,23 @@ module Dev
8
8
 
9
9
  def initialize
10
10
  @client = ::Aws::Route53::Client.new
11
- @zones = []
12
11
  end
13
12
 
14
- def get_hosted_zones(domains)
13
+ def hosted_zones(domains)
14
+ @zones = []
15
15
  if domains.empty?
16
- response = client.list_hosted_zones
17
- response.hosted_zones.each do |hosted_zone|
18
- @zones << hosted_zone.id
16
+ @zones = [].tap do |ary|
17
+ Dev::Aws.each_page(client, :list_hosted_zones, {max_items: 2}) do |response|
18
+ response.hosted_zones.each do |hosted_zone|
19
+ ary << hosted_zone.id unless hosted_zone.config.private_zone
20
+ end
21
+ end
19
22
  end
20
23
  else
21
24
  domains.each do |domain_name|
22
25
  zone = client.list_hosted_zones_by_name({dns_name: domain_name, max_items: 1})
23
- target_name = zone.hosted_zones[0].name.chomp!('.') if zone.hosted_zones[0].name.end_with?('.')
24
- @zones << zone.hosted_zones[0].id unless target_name != domain_name
26
+ target_name = zone.hosted_zones.first.name.chomp!('.')
27
+ @zones << zone.hosted_zones.first.id unless target_name != domain_name
25
28
  end
26
29
  end
27
30
  raise 'Hosted zone(s) not found.' if @zones.empty?
@@ -32,7 +35,7 @@ module Dev
32
35
  hosted_zone_id: zone_id,
33
36
  max_results: '1'
34
37
  )
35
- config.query_logging_configs[0].id unless config.query_logging_configs.empty? || config.query_logging_configs[0].hosted_zone_id == zone_id
38
+ config.query_logging_configs.first.id unless config.query_logging_configs.empty? || config.query_logging_configs.first.hosted_zone_id == zone_id
36
39
  end
37
40
 
38
41
  def activate_query_logging(log_group)
@@ -121,55 +121,60 @@ module Dev
121
121
  end
122
122
  end
123
123
 
124
- # rubocop:disable Metrics/MethodLength
125
124
  # Create the rake task for the hosted zone method
126
- def create_hosted_zone_task!
125
+ def create_dns_logging_activate_task!
127
126
  # Have to set a local variable to be accessible inside of the instance_eval block
128
127
  exclude = @exclude
129
128
 
130
129
  DEV_COMMANDS_TOP_LEVEL.instance_eval do
131
130
  namespace :aws do
132
- return if exclude.include?(:hosted_zone)
131
+ return if exclude.include?(:dns_logging)
133
132
 
134
133
  namespace :hosted_zone do
135
134
  namespace :dns_logging do
136
- task :init do
137
- @route53 = Dev::Aws::Route53.new
138
-
139
- domains = ENV['DOMAINS'].to_s.strip.split(',')
140
- domain = ENV['DOMAIN'].to_s.strip
141
- domains << domain unless domain.empty?
142
-
143
- # Set global zone id array
144
- @route53.get_hosted_zones(domains)
145
- end
146
-
147
135
  desc 'Activates query logging for all hosted zones by default.' \
148
136
  'This command should be run from the account the hosted zone(s) reside.' \
149
- "\n\toptionally specify DOMAIN='foo.com' to specify the hosted zone to activate." \
137
+ "\n\toptionally specify HOSTED_ZONE_GROUP='arn:aws:logs:REGION:ACCOUNT_ID:' to specify the ARN of the target log group." \
150
138
  "\n\toptionally specify DOMAINS='foo.com,foobar.com' to specify the hosted zones to activate." \
151
139
  "\n\t\tComma delimited list."
152
- task activate: %w(init) do
140
+ task :activate do
141
+ route53 = Dev::Aws::Route53.new
142
+ route53.hosted_zones(ENV['DOMAINS'].to_s.strip.split(','))
153
143
  # Use user defined log group. Otherwise, go get the default.
154
144
  log_group = (ENV['HOSTED_ZONE_GROUP'] || Dev::Aws::Parameter.new.get_value('/Firespring/Internal/Route53/hosted-zone/log-group-arn'))
155
-
156
- @route53.activate_query_logging(log_group)
145
+ route53.activate_query_logging(log_group)
157
146
  end
147
+ end
148
+ end
149
+ end
150
+ end
151
+ end
158
152
 
153
+ # Create the rake task for the hosted zone method
154
+ def create_dns_logging_deactivate_task!
155
+ # Have to set a local variable to be accessible inside of the instance_eval block
156
+ exclude = @exclude
157
+
158
+ DEV_COMMANDS_TOP_LEVEL.instance_eval do
159
+ namespace :aws do
160
+ return if exclude.include?(:dns_logging_de)
161
+
162
+ namespace :hosted_zone do
163
+ namespace :dns_logging do
159
164
  desc 'Deactivates query logging for all hosted zones by default. ' \
160
165
  'This command should be run from the account the hosted zone(s) reside.' \
161
- "\n\toptionally specify DOMAIN='foo.com' to specify the hosted zone to activate." \
162
166
  "\n\toptionally specify DOMAINS='foo.com,foobar.com' to specify the hosted zones to activate." \
163
167
  "\n\t\tComma delimited list."
164
- task deactivate: %w(init) do
165
- @route53.deactivate_query_logging
168
+ task :deactivate do
169
+ route53 = Dev::Aws::Route53.new
170
+ route53.hosted_zones(ENV['DOMAINS'].to_s.strip.split(','))
171
+ route53.deactivate_query_logging
166
172
  end
167
173
  end
168
174
  end
169
175
  end
170
176
  end
171
177
  end
172
- # rubocop:enable Metrics/MethodLength
173
178
  end
174
179
  end
175
180
  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.32.pre.alpha.0'.freeze
9
+ VERSION = '2.1.32.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.32.pre.alpha.0
4
+ version: 2.1.32.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: 2024-04-17 00:00:00.000000000 Z
11
+ date: 2024-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport