firespring_dev_commands 2.1.32.pre.alpha.4 → 2.1.32.pre.alpha.6

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: fdc619a8748de80444363d7bf216ffc4c4ffcb706b2ca9478e4a156203529bb8
4
- data.tar.gz: 1195bb833ab7fae4d713bf1c8f6401e83bd3dde8146f7a75fe6ac999be40ad29
3
+ metadata.gz: 781981f7124ed8478708915fa0539f9f8d6c21993a707ac712b8d8f27b020ce7
4
+ data.tar.gz: a974f5d4aae9aeeb5ed044ab69ce46a6e95d518cd685583788d0728dd0b20fb7
5
5
  SHA512:
6
- metadata.gz: b3d96c11b5828232f415a9f36731ac2e649c07f2be927e24f64b973834db3d2db8d1a5ad80a96fc1ae9485848b964601a435d9208d85f154afabc6ce45355e50
7
- data.tar.gz: 709779690537ec9e1a292599c9050f81f8364bcc98d2547f9b13dec3486fcae295a92d504b19a3ca513242731bc514c9a46a8a38677f77db0e0522e92dec4a4e
6
+ metadata.gz: 0fc54a00a5e86b124183319ccfaaeb56237db467ead8ba5ae2b6bf9c94156dae4f01b27df2fdafe48159bc342b9bb94613fa68105fc1d9265f341f058b186c37
7
+ data.tar.gz: c564197a7cb19604caee3e38e05bf553574164f3e3b58733676f619282ce64851e08739c85940c0d6b9a3cd2652f4b79f383583d555f5cb6e0028f23e62fbe63
@@ -2,22 +2,22 @@ module Dev
2
2
  class Aws
3
3
  # Class for performing Route53 functions
4
4
  class Route53
5
- attr_reader :client, :zones
5
+ attr_reader :client
6
6
 
7
- def initialize
7
+ def initialize(domains)
8
8
  @client = ::Aws::Route53::Client.new
9
- @zones = nil
9
+ @domains = domains
10
10
  end
11
11
 
12
- def zones(domains = [])
13
- @zones ||= if domains.empty?
14
- all_zones
15
- else
16
- zones_by_domain_names(domains)
17
- end
12
+ private def zones
13
+ if @domains.empty?
14
+ all_zones
15
+ else
16
+ zones_by_domain_names(@domains)
17
+ end
18
18
  end
19
19
 
20
- def all_zones
20
+ private def all_zones
21
21
  [].tap do |ary|
22
22
  Dev::Aws.each_page(client, :list_hosted_zones) do |response|
23
23
  response.hosted_zones&.each do |hosted_zone|
@@ -27,7 +27,7 @@ module Dev
27
27
  end
28
28
  end
29
29
 
30
- def zones_by_domain_names(domains)
30
+ private def zones_by_domain_names(domains)
31
31
  [].tap do |ary|
32
32
  domains.each do |domain_name|
33
33
  response = client.list_hosted_zones_by_name({dns_name: domain_name})
@@ -39,14 +39,14 @@ module Dev
39
39
  end
40
40
  end
41
41
 
42
- def target_config_id(zone_id)
42
+ private def target_config_id(zone_id)
43
43
  client.list_query_logging_configs(
44
44
  hosted_zone_id: zone_id,
45
45
  max_results: '1'
46
46
  ).query_logging_configs&.first&.id
47
47
  end
48
48
 
49
- def pretty_puts(output)
49
+ private def pretty_puts(output)
50
50
  # Find the maximum length of the keys
51
51
  max_key_length = output.keys.map(&:to_s).max_by(&:length).length
52
52
 
@@ -57,7 +57,7 @@ module Dev
57
57
 
58
58
  def list_query_configs
59
59
  output = {}
60
- @zones.each do |zone|
60
+ zones.each do |zone|
61
61
  target_config_id = target_config_id(zone.id)
62
62
 
63
63
  output[zone.name] = if target_config_id
@@ -73,7 +73,7 @@ module Dev
73
73
  def activate_query_logging(log_group)
74
74
  output = {}
75
75
 
76
- @zones.each do |zone|
76
+ zones.each do |zone|
77
77
  response = client.create_query_logging_config(
78
78
  hosted_zone_id: zone.id,
79
79
  cloud_watch_logs_log_group_arn: log_group
@@ -89,7 +89,7 @@ module Dev
89
89
 
90
90
  def deactivate_query_logging
91
91
  output = {}
92
- @zones.each do |zone|
92
+ zones.each do |zone|
93
93
  target_config_id = target_config_id(zone.id)
94
94
  if target_config_id
95
95
  client.delete_query_logging_config(
@@ -33,15 +33,14 @@ module Dev
33
33
  namespace :dns_logging do
34
34
  desc 'Activates query logging for all hosted zones by default.' \
35
35
  'This command should be run from the account the hosted zone(s) reside.' \
36
- "\n\t(Required) Specify HOSTED_ZONE_GROUP='arn:aws:logs:REGION:ACCOUNT_ID:' to specify the ARN of the target log group." \
36
+ "\n\t(Required) Specify LOG_GROUP_ARN='arn:aws:logs:REGION:ACCOUNT_ID:' to specify the ARN of the target log group." \
37
37
  "\n\toptionally specify DOMAINS='foo.com,foobar.com' to specify the hosted zones to activate." \
38
38
  "\n\t\tComma delimited list."
39
39
  task activate: %w(ensure_aws_credentials) do
40
- route53 = Dev::Aws::Route53.new
41
- route53.zones(ENV['DOMAINS'].to_s.strip.split(','))
40
+ route53 = Dev::Aws::Route53.new(ENV['DOMAINS'].to_s.strip.split(','))
42
41
  # Use user defined log group.
43
- log_group = ENV.fetch('HOSTED_ZONE_GROUP', nil)
44
- raise 'The Hosted Zone Log Group ARN, HOSTED_ZONE_GROUP, is required' unless log_group
42
+ log_group = ENV.fetch('LOG_GROUP_ARN', nil)
43
+ raise 'The Hosted Zone Log Group ARN, LOG_GROUP_ARN, is required' unless log_group
45
44
 
46
45
  route53.activate_query_logging(log_group)
47
46
  end
@@ -67,8 +66,7 @@ module Dev
67
66
  "\n\toptionally specify DOMAINS='foo.com,foobar.com' to specify the hosted zones to activate." \
68
67
  "\n\t\tComma delimited list."
69
68
  task deactivate: %w(ensure_aws_credentials) do
70
- route53 = Dev::Aws::Route53.new
71
- route53.zones(ENV['DOMAINS'].to_s.strip.split(','))
69
+ route53 = Dev::Aws::Route53.new(ENV['DOMAINS'].to_s.strip.split(','))
72
70
  route53.deactivate_query_logging
73
71
  end
74
72
  end
@@ -93,8 +91,7 @@ module Dev
93
91
  "\n\toptionally specify DOMAINS='foo.com,foobar.com' to specify the hosted zones to activate." \
94
92
  "\n\t\tComma delimited list."
95
93
  task list_query_configs: %w(ensure_aws_credentials) do
96
- route53 = Dev::Aws::Route53.new
97
- route53.zones(ENV['DOMAINS'].to_s.strip.split(','))
94
+ route53 = Dev::Aws::Route53.new(ENV['DOMAINS'].to_s.strip.split(','))
98
95
  route53.list_query_configs
99
96
  end
100
97
  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.4'.freeze
9
+ VERSION = '2.1.32.pre.alpha.6'.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.4
4
+ version: 2.1.32.pre.alpha.6
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-24 00:00:00.000000000 Z
11
+ date: 2024-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport