firespring_dev_commands 3.0.0.pre.alpha.5 → 3.0.0
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 +4 -4
- data/README.md +1 -1
- data/lib/firespring_dev_commands/aws/cloudformation.rb +10 -3
- data/lib/firespring_dev_commands/aws/route53.rb +107 -0
- data/lib/firespring_dev_commands/common.rb +13 -2
- data/lib/firespring_dev_commands/docker.rb +41 -16
- data/lib/firespring_dev_commands/eol/aws.rb +10 -2
- data/lib/firespring_dev_commands/target_process/release.rb +1 -1
- data/lib/firespring_dev_commands/target_process/team_assignment.rb +1 -1
- data/lib/firespring_dev_commands/target_process/time.rb +32 -0
- data/lib/firespring_dev_commands/target_process/user.rb +13 -1
- data/lib/firespring_dev_commands/target_process/user_story.rb +1 -1
- data/lib/firespring_dev_commands/target_process/user_story_history.rb +1 -1
- data/lib/firespring_dev_commands/target_process.rb +21 -6
- data/lib/firespring_dev_commands/templates/aws/services/route53.rb +106 -0
- data/lib/firespring_dev_commands/version.rb +1 -1
- metadata +21 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f09642881cf14415ae741df17f416995ec52042a1402970751e465155d55409
|
4
|
+
data.tar.gz: d20ce0d49a6e2793369a272c5950ef716c3f74cdad8a548efac2d390a2f61eb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1119f8fa30997e2dd4124d2b4390bb6da5c57a960ecf3b0150092f9d06a6fb0962ffd0a0cf84e9decca65d6b6d8334c29ded5c3c28de4b42398abd6723f3e7e1
|
7
|
+
data.tar.gz: 565069b5e6914d445090aa1afc34bf2ac5476e7ed0118630fd78f44a60c2447ebfa5403f2f69979a8381b3d3b133b91636c8492398357707e0eee2231cf65af8
|
data/README.md
CHANGED
@@ -28,7 +28,7 @@ Dev::Template::Docker::Node::Application.new('foo')
|
|
28
28
|
```
|
29
29
|
* If you run `rake -T` now, you should have base rake commands and application rake commands for an app called `foo`
|
30
30
|
|
31
|
-
* (
|
31
|
+
* (optional) Add AWS login template commands
|
32
32
|
```
|
33
33
|
# Configure AWS accounts and create tasks
|
34
34
|
Dev::Aws::Account::configure do |c|
|
@@ -21,9 +21,10 @@ module Dev
|
|
21
21
|
# Finished status
|
22
22
|
FINISHED = :finished
|
23
23
|
|
24
|
-
attr_accessor :client, :name, :template_filename, :parameters, :capabilities, :failure_behavior, :state
|
24
|
+
attr_accessor :client, :name, :template_filename, :parameters, :capabilities, :failure_behavior, :preserve_parameters_on_update, :state
|
25
25
|
|
26
|
-
def initialize(name, template_filename, parameters: Dev::Aws::Cloudformation::Parameters.new, capabilities: [], failure_behavior: 'ROLLBACK'
|
26
|
+
def initialize(name, template_filename, parameters: Dev::Aws::Cloudformation::Parameters.new, capabilities: [], failure_behavior: 'ROLLBACK',
|
27
|
+
preserve_parameters_on_update: false)
|
27
28
|
raise 'parameters must be an intsance of parameters' unless parameters.is_a?(Dev::Aws::Cloudformation::Parameters)
|
28
29
|
|
29
30
|
@client = nil
|
@@ -32,6 +33,7 @@ module Dev
|
|
32
33
|
@parameters = parameters
|
33
34
|
@capabilities = capabilities
|
34
35
|
@failure_behavior = failure_behavior
|
36
|
+
@preserve_parameters_on_update = preserve_parameters_on_update
|
35
37
|
@state = NOT_STARTED
|
36
38
|
end
|
37
39
|
|
@@ -81,11 +83,16 @@ module Dev
|
|
81
83
|
# Call upload function to get the s3 url
|
82
84
|
template_url = upload(template_filename)
|
83
85
|
|
86
|
+
update_parameters = if preserve_parameters_on_update
|
87
|
+
parameters.preserve
|
88
|
+
else
|
89
|
+
parameters.default
|
90
|
+
end
|
84
91
|
# Update the cloudformation stack
|
85
92
|
client.update_stack(
|
86
93
|
stack_name: name,
|
87
94
|
template_url:,
|
88
|
-
parameters:
|
95
|
+
parameters: update_parameters,
|
89
96
|
capabilities:
|
90
97
|
)
|
91
98
|
@state = STARTED
|
@@ -0,0 +1,107 @@
|
|
1
|
+
module Dev
|
2
|
+
class Aws
|
3
|
+
# Class for performing Route53 functions
|
4
|
+
class Route53
|
5
|
+
attr_reader :client
|
6
|
+
|
7
|
+
def initialize(domains)
|
8
|
+
@client = ::Aws::Route53::Client.new
|
9
|
+
@domains = domains
|
10
|
+
end
|
11
|
+
|
12
|
+
private def zones
|
13
|
+
if @domains.empty?
|
14
|
+
all_zones
|
15
|
+
else
|
16
|
+
zones_by_domain_names(@domains)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private def all_zones
|
21
|
+
[].tap do |ary|
|
22
|
+
Dev::Aws.each_page(client, :list_hosted_zones) do |response|
|
23
|
+
response.hosted_zones&.each do |hosted_zone|
|
24
|
+
ary << hosted_zone unless hosted_zone.config.private_zone
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private def zones_by_domain_names(domains)
|
31
|
+
[].tap do |ary|
|
32
|
+
domains.each do |domain_name|
|
33
|
+
response = client.list_hosted_zones_by_name({dns_name: domain_name})
|
34
|
+
target = response.hosted_zones.find { |it| it.name.chomp('.') == domain_name }
|
35
|
+
raise "The #{domain_name} hosted zone not found." unless target
|
36
|
+
|
37
|
+
ary << target
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
private def target_config_id(zone_id)
|
43
|
+
client.list_query_logging_configs(
|
44
|
+
hosted_zone_id: zone_id,
|
45
|
+
max_results: '1'
|
46
|
+
).query_logging_configs&.first&.id
|
47
|
+
end
|
48
|
+
|
49
|
+
private def pretty_puts(output)
|
50
|
+
# Find the maximum length of the keys
|
51
|
+
max_key_length = output.keys.map(&:to_s).max_by(&:length).length
|
52
|
+
|
53
|
+
output.each do |key, value|
|
54
|
+
puts "#{key.to_s.ljust(max_key_length)}\t=>\t#{value}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def list_query_configs
|
59
|
+
output = {}
|
60
|
+
zones.each do |zone|
|
61
|
+
target_config_id = target_config_id(zone.id)
|
62
|
+
|
63
|
+
output[zone.name] = if target_config_id
|
64
|
+
"Config\t=>\t#{target_config_id}".colorize(:green)
|
65
|
+
else
|
66
|
+
'No query logging config assigned.'.colorize(:red)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
pretty_puts(output)
|
71
|
+
end
|
72
|
+
|
73
|
+
def activate_query_logging(log_group)
|
74
|
+
output = {}
|
75
|
+
|
76
|
+
zones.each do |zone|
|
77
|
+
response = client.create_query_logging_config(
|
78
|
+
hosted_zone_id: zone.id,
|
79
|
+
cloud_watch_logs_log_group_arn: log_group
|
80
|
+
)
|
81
|
+
output[zone.id] = response.location
|
82
|
+
rescue ::Aws::Route53::Errors::ServiceError => e
|
83
|
+
raise "Error: #{e.message}" unless e.instance_of?(::Aws::Route53::Errors::QueryLoggingConfigAlreadyExists)
|
84
|
+
|
85
|
+
output[zone.id] = e.message
|
86
|
+
end
|
87
|
+
pretty_puts(output)
|
88
|
+
end
|
89
|
+
|
90
|
+
def deactivate_query_logging
|
91
|
+
output = {}
|
92
|
+
zones.each do |zone|
|
93
|
+
target_config_id = target_config_id(zone.id)
|
94
|
+
if target_config_id
|
95
|
+
client.delete_query_logging_config(
|
96
|
+
id: target_config_id
|
97
|
+
)
|
98
|
+
output[zone.id] = 'Query logging config removed.'.colorize(:green)
|
99
|
+
else
|
100
|
+
output[zone.id] = 'No query logging config assigned.'.colorize(:red)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
pretty_puts(output)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -78,8 +78,8 @@ module Dev
|
|
78
78
|
# Receive a string from the user on stdin unless non_interactive is set to true
|
79
79
|
# If a default value was specified and no answer was given, return the default
|
80
80
|
def gather_input(default: nil)
|
81
|
-
answer = $stdin.gets
|
82
|
-
answer.to_s.strip
|
81
|
+
answer = $stdin.gets unless ENV['NON_INTERACTIVE'] == 'true'
|
82
|
+
answer = answer.to_s.strip
|
83
83
|
return default if default && answer.empty?
|
84
84
|
|
85
85
|
answer
|
@@ -185,5 +185,16 @@ module Dev
|
|
185
185
|
center_str = string.length / 2
|
186
186
|
string.rjust(center_dash + center_str - 1, pad).ljust(len - 1, pad)
|
187
187
|
end
|
188
|
+
|
189
|
+
# Print the given filesize using the most appropriate units
|
190
|
+
def filesize(size)
|
191
|
+
return '0.0 B' if size.to_i.zero?
|
192
|
+
|
193
|
+
units = %w(B KB MB GB TB Pb EB)
|
194
|
+
exp = (Math.log(size) / Math.log(1024)).to_i
|
195
|
+
exp = 6 if exp > 6
|
196
|
+
|
197
|
+
format('%.1f %s', size.to_f / (1024**exp), units[exp])
|
198
|
+
end
|
188
199
|
end
|
189
200
|
end
|
@@ -174,28 +174,53 @@ module Dev
|
|
174
174
|
end
|
175
175
|
|
176
176
|
# Copies the source path on your local machine to the destination path on the container
|
177
|
-
def copy_to_container(container,
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
177
|
+
def copy_to_container(container, source, destination)
|
178
|
+
# Add the working dir of the container onto the destination (if it doesn't start a path separator)
|
179
|
+
destination = File.join(working_dir(container), destination) unless destination.start_with?(File::SEPARATOR)
|
180
|
+
LOG.info "Copying #{source} to #{destination}..."
|
181
|
+
|
182
|
+
# Need to determine the type of the destination (file or directory or nonexistant)
|
183
|
+
noexist_code = 22
|
184
|
+
file_code = 33
|
185
|
+
directory_code = 44
|
186
|
+
unknown_code = 55
|
187
|
+
filetype_cmd = [
|
188
|
+
'bash',
|
189
|
+
'-c',
|
190
|
+
"set -e; [ ! -e '#{destination}' ] && exit #{noexist_code}; [ -f '#{destination}' ] " \
|
191
|
+
"&& exit #{file_code}; [ -d '#{destination}' ] && exit #{directory_code}; exit #{unknown_code}"
|
192
|
+
]
|
193
|
+
destination_filetype_code = container.exec(filetype_cmd).last
|
194
|
+
|
195
|
+
# If destination_filetype_code is a file - that means the user passed in a destination filename
|
196
|
+
# Unfortunately the archive_in command does not support that so we will strip it off and use it later (if needed)
|
197
|
+
source_filename = File.basename(source)
|
198
|
+
destination_filename = File.basename(source)
|
199
|
+
destination, _, destination_filename = destination.rpartition(File::SEPARATOR) if destination_filetype_code == file_code
|
200
|
+
|
201
|
+
container.archive_in(source, destination, overwrite: true)
|
202
|
+
|
203
|
+
if File.directory?(source)
|
204
|
+
# If the source was a directory, then the archive_in command leaves it as a tar on the system - so we need to unpack it
|
205
|
+
# TODO: Can we find a better solution for this? Seems pretty brittle
|
206
|
+
retcode = container.exec(['bash', '-c', "cd #{destination}; tar -xf #{destination_filename}; rm -f #{destination_filename}"]).last
|
207
|
+
raise 'Unable to unpack on container' unless retcode.zero?
|
208
|
+
elsif destination_filetype_code == file_code && source_filename != destination_filename
|
209
|
+
# If the destination was a file _and_ the filename is different than the source filename, then we need to rename it
|
210
|
+
retcode = container.exec(['bash', '-c', "cd #{destination}; mv #{source_filename} #{destination_filename}"]).last
|
211
|
+
raise "Unable to rename '#{source_filename}' to '#{destination_filename}' on container" unless retcode.zero?
|
212
|
+
end
|
188
213
|
end
|
189
214
|
|
190
215
|
# Copies the source path on the container to the destination path on your local machine
|
191
216
|
# If required is set to true, the command will fail if the source path does not exist on the container
|
192
|
-
def copy_from_container(container,
|
193
|
-
|
194
|
-
LOG.info "Copying #{
|
217
|
+
def copy_from_container(container, source, destination, required: true)
|
218
|
+
source = File.join(working_dir(container), source) unless source.start_with?(File::SEPARATOR)
|
219
|
+
LOG.info "Copying #{source} to #{destination}..."
|
195
220
|
|
196
221
|
tar = StringIO.new
|
197
222
|
begin
|
198
|
-
container.archive_out(
|
223
|
+
container.archive_out(source) do |chunk|
|
199
224
|
tar.write(chunk)
|
200
225
|
end
|
201
226
|
rescue => e
|
@@ -204,7 +229,7 @@ module Dev
|
|
204
229
|
puts "#{source_path} Not Found"
|
205
230
|
end
|
206
231
|
|
207
|
-
Dev::Tar.new(tar).unpack(
|
232
|
+
Dev::Tar.new(tar).unpack(source, destination)
|
208
233
|
end
|
209
234
|
|
210
235
|
# rubocop:disable Metrics/ParameterLists
|
@@ -72,19 +72,23 @@ module Dev
|
|
72
72
|
# Queries and returns product versions for rds instance products
|
73
73
|
def rds_instance_products
|
74
74
|
aws_engines = %w(mysql postgresql)
|
75
|
+
aws_sqlserver_engines = %w(sqlserver-ee sqlserver-ex sqlserver-se sqlserver-web)
|
75
76
|
client = ::Aws::RDS::Client.new
|
76
77
|
|
77
78
|
[].tap do |ary|
|
78
79
|
Dev::Aws.each_page(client, :describe_db_instances) do |response|
|
79
80
|
response.db_instances.each do |instance|
|
80
81
|
name = instance.db_instance_identifier
|
81
|
-
engine = instance.engine.
|
82
|
+
engine = instance.engine.gsub('aurora-', '')
|
82
83
|
product = if aws_engines.include?(engine)
|
83
84
|
"amazon-rds-#{engine}"
|
85
|
+
elsif aws_sqlserver_engines.include?(engine)
|
86
|
+
'mssqlserver'
|
84
87
|
else
|
85
88
|
engine
|
86
89
|
end
|
87
90
|
version = instance.engine_version.reverse.split('.')[-2..].join('.').reverse
|
91
|
+
version.chop! if version.end_with?('.00')
|
88
92
|
ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
|
89
93
|
end
|
90
94
|
end
|
@@ -94,19 +98,23 @@ module Dev
|
|
94
98
|
# Queries and returns product versions for rds cluster products
|
95
99
|
def rds_cluster_products
|
96
100
|
aws_engines = %w(mysql postgresql)
|
101
|
+
aws_sqlserver_engines = %w(sqlserver-ee sqlserver-ex sqlserver-se sqlserver-web)
|
97
102
|
client = ::Aws::RDS::Client.new
|
98
103
|
|
99
104
|
[].tap do |ary|
|
100
105
|
Dev::Aws.each_page(client, :describe_db_clusters) do |response|
|
101
106
|
response.db_clusters.each do |cluster|
|
102
107
|
name = cluster.db_cluster_identifier
|
103
|
-
engine = cluster.engine.
|
108
|
+
engine = cluster.engine.gsub('aurora-', '')
|
104
109
|
product = if aws_engines.include?(engine)
|
105
110
|
"amazon-rds-#{engine}"
|
111
|
+
elsif aws_sqlserver_engines.include?(engine)
|
112
|
+
'mssqlserver'
|
106
113
|
else
|
107
114
|
engine
|
108
115
|
end
|
109
116
|
version = cluster.engine_version.reverse.split('.')[-2..].join('.').reverse
|
117
|
+
version.chop! if version.end_with?('.00')
|
110
118
|
ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
|
111
119
|
end
|
112
120
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Dev
|
2
|
+
class TargetProcess
|
3
|
+
# The class to query time information from Target Process
|
4
|
+
class Time
|
5
|
+
# The resource type for the api endpoint
|
6
|
+
RESOURCE_TYPE = 'Time'.freeze
|
7
|
+
|
8
|
+
# The api path for time requests
|
9
|
+
PATH = '/Time'.freeze
|
10
|
+
|
11
|
+
attr_accessor :data, :id, :type, :description, :hours, :date, :story, :user
|
12
|
+
|
13
|
+
def initialize(data)
|
14
|
+
@data = data
|
15
|
+
@id = data['Id']
|
16
|
+
@type = data['ResourceType']
|
17
|
+
@description = data['Description']
|
18
|
+
@hours = data['Spent']
|
19
|
+
@date = parse_time(data['Date'])
|
20
|
+
@story = UserStory.new(data['Assignable']) if data['Assignable']
|
21
|
+
@user = User.new(data['User']) if data['User']
|
22
|
+
end
|
23
|
+
|
24
|
+
# Parse the dot net time representation into something that ruby can use
|
25
|
+
def parse_time(string)
|
26
|
+
return nil unless string && !string.empty?
|
27
|
+
|
28
|
+
::Time.at(string.slice(6, 10).to_i)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -2,7 +2,13 @@ module Dev
|
|
2
2
|
class TargetProcess
|
3
3
|
# Class containing user information
|
4
4
|
class User
|
5
|
-
|
5
|
+
# The resource type for the api endpoint
|
6
|
+
RESOURCE_TYPE = 'User'.freeze
|
7
|
+
|
8
|
+
# The api path for user requests
|
9
|
+
PATH = '/User'.freeze
|
10
|
+
|
11
|
+
attr_accessor :data, :id, :type, :name, :login, :email
|
6
12
|
|
7
13
|
def initialize(data)
|
8
14
|
@data = data
|
@@ -10,6 +16,12 @@ module Dev
|
|
10
16
|
@type = data['ResourceType']
|
11
17
|
@name = data['FullName']
|
12
18
|
@login = data['Login']
|
19
|
+
@email = data['Email']
|
20
|
+
end
|
21
|
+
|
22
|
+
# Get the user with the given id and return that object
|
23
|
+
def self.get(id)
|
24
|
+
new(TargetProcess.new.get("#{User::PATH}/#{id}", Query.new))
|
13
25
|
end
|
14
26
|
end
|
15
27
|
end
|
@@ -72,8 +72,8 @@ module Dev
|
|
72
72
|
[].tap do |ary|
|
73
73
|
get(Release::PATH, query) do |result|
|
74
74
|
ary << Release.new(result)
|
75
|
+
yield ary.last if block_given?
|
75
76
|
end
|
76
|
-
ary.each(&)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -84,8 +84,8 @@ module Dev
|
|
84
84
|
[].tap do |ary|
|
85
85
|
get(UserStory::PATH, query) do |result|
|
86
86
|
ary << UserStory.new(result)
|
87
|
+
yield ary.last if block_given?
|
87
88
|
end
|
88
|
-
ary.each(&)
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
@@ -96,8 +96,8 @@ module Dev
|
|
96
96
|
[].tap do |ary|
|
97
97
|
get(UserStoryHistory::PATH, query) do |result|
|
98
98
|
ary << UserStoryHistory.new(result)
|
99
|
+
yield ary.last if block_given?
|
99
100
|
end
|
100
|
-
ary.each(&)
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
@@ -108,8 +108,20 @@ module Dev
|
|
108
108
|
[].tap do |ary|
|
109
109
|
get(TeamAssignment::PATH, query) do |result|
|
110
110
|
ary << TeamAssignment.new(result)
|
111
|
+
yield ary.last if block_given?
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# Perform a query to the time api path
|
117
|
+
# Call the given block (if present) with each time
|
118
|
+
# Return all times
|
119
|
+
def times(query, &)
|
120
|
+
[].tap do |ary|
|
121
|
+
get(Time::PATH, query) do |result|
|
122
|
+
ary << Time.new(result)
|
123
|
+
yield ary.last if block_given?
|
111
124
|
end
|
112
|
-
ary.each(&)
|
113
125
|
end
|
114
126
|
end
|
115
127
|
|
@@ -132,8 +144,11 @@ module Dev
|
|
132
144
|
parsed_response['Items'].each(&)
|
133
145
|
|
134
146
|
while parsed_response['Next']
|
135
|
-
|
136
|
-
|
147
|
+
next_query_string = URI(parsed_response['Next']).query
|
148
|
+
next_url = "/api/v1/#{path}"
|
149
|
+
next_url << "?#{next_query_string}" unless query_string.empty?
|
150
|
+
response = client.request_get(next_url, headers)
|
151
|
+
raise "Error querying #{next_url} [#{next_query_string}]: #{response.inspect}" unless response.response.is_a?(Net::HTTPSuccess)
|
137
152
|
|
138
153
|
parsed_response = JSON.parse(response.body)
|
139
154
|
return parsed_response unless parsed_response.key?('Items')
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require_relative '../../base_interface'
|
2
|
+
|
3
|
+
module Dev
|
4
|
+
module Template
|
5
|
+
class Aws
|
6
|
+
module Services
|
7
|
+
# Class contains rake templates for managing your AWS settings and logging in
|
8
|
+
class Route53 < Dev::Template::BaseInterface
|
9
|
+
# Create the rake task which ensures active credentials are present
|
10
|
+
def create_ensure_credentials_task!
|
11
|
+
# Have to set a local variable to be accessible inside of the instance_eval block
|
12
|
+
exclude = @exclude
|
13
|
+
|
14
|
+
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
15
|
+
return if exclude.include?(:ensure_aws_credentials)
|
16
|
+
|
17
|
+
task ensure_aws_credentials: %w(init) do
|
18
|
+
raise 'AWS Credentials not found / expired' unless Dev::Aws::Credentials.new.active?
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Create the rake task for the hosted zone method
|
24
|
+
def create_dns_logging_activate_task!
|
25
|
+
# Have to set a local variable to be accessible inside of the instance_eval block
|
26
|
+
exclude = @exclude
|
27
|
+
|
28
|
+
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
29
|
+
namespace :aws do
|
30
|
+
return if exclude.include?(:dns_logging)
|
31
|
+
|
32
|
+
namespace :hosted_zone do
|
33
|
+
namespace :dns_logging do
|
34
|
+
desc 'Activates query logging for all hosted zones by default.' \
|
35
|
+
'This command should be run from the account the hosted zone(s) reside.' \
|
36
|
+
"\n\t(Required) Specify LOG_GROUP_ARN='arn:aws:logs:REGION:ACCOUNT_ID:' to specify the ARN of the target log group." \
|
37
|
+
"\n\toptionally specify DOMAINS='foo.com,foobar.com' to specify the hosted zones to activate." \
|
38
|
+
"\n\t\tComma delimited list."
|
39
|
+
task activate: %w(ensure_aws_credentials) do
|
40
|
+
route53 = Dev::Aws::Route53.new(ENV['DOMAINS'].to_s.strip.split(','))
|
41
|
+
# Use user defined 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
|
44
|
+
|
45
|
+
route53.activate_query_logging(log_group)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# Create the rake task for the hosted zone method
|
54
|
+
def create_dns_logging_deactivate_task!
|
55
|
+
# Have to set a local variable to be accessible inside of the instance_eval block
|
56
|
+
exclude = @exclude
|
57
|
+
|
58
|
+
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
59
|
+
namespace :aws do
|
60
|
+
return if exclude.include?(:dns_logging)
|
61
|
+
|
62
|
+
namespace :hosted_zone do
|
63
|
+
namespace :dns_logging do
|
64
|
+
desc 'Deactivates query logging for all hosted zones by default. ' \
|
65
|
+
'This command should be run from the account the hosted zone(s) reside.' \
|
66
|
+
"\n\toptionally specify DOMAINS='foo.com,foobar.com' to specify the hosted zones to activate." \
|
67
|
+
"\n\t\tComma delimited list."
|
68
|
+
task deactivate: %w(ensure_aws_credentials) do
|
69
|
+
route53 = Dev::Aws::Route53.new(ENV['DOMAINS'].to_s.strip.split(','))
|
70
|
+
route53.deactivate_query_logging
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# Create the rake task for the hosted zone method
|
79
|
+
def create_list_query_config_task!
|
80
|
+
# Have to set a local variable to be accessible inside of the instance_eval block
|
81
|
+
exclude = @exclude
|
82
|
+
|
83
|
+
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
84
|
+
namespace :aws do
|
85
|
+
return if exclude.include?(:dns_logging)
|
86
|
+
|
87
|
+
namespace :hosted_zone do
|
88
|
+
namespace :dns_logging do
|
89
|
+
desc 'Lists the current config for domain(s). ' \
|
90
|
+
'This command should be run from the account the hosted zone(s) reside.' \
|
91
|
+
"\n\toptionally specify DOMAINS='foo.com,foobar.com' to specify the hosted zones to activate." \
|
92
|
+
"\n\t\tComma delimited list."
|
93
|
+
task list_query_configs: %w(ensure_aws_credentials) do
|
94
|
+
route53 = Dev::Aws::Route53.new(ENV['DOMAINS'].to_s.strip.split(','))
|
95
|
+
route53.list_query_configs
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
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: 3.0.0
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Firespring
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03
|
11
|
+
date: 2024-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 1.208.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: aws-sdk-route53
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 1.87.0
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.87.0
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: aws-sdk-s3
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -326,6 +340,7 @@ files:
|
|
326
340
|
- lib/firespring_dev_commands/aws/login.rb
|
327
341
|
- lib/firespring_dev_commands/aws/parameter.rb
|
328
342
|
- lib/firespring_dev_commands/aws/profile.rb
|
343
|
+
- lib/firespring_dev_commands/aws/route53.rb
|
329
344
|
- lib/firespring_dev_commands/aws/s3.rb
|
330
345
|
- lib/firespring_dev_commands/bloom_growth.rb
|
331
346
|
- lib/firespring_dev_commands/bloom_growth/rock.rb
|
@@ -381,10 +396,12 @@ files:
|
|
381
396
|
- lib/firespring_dev_commands/target_process/release.rb
|
382
397
|
- lib/firespring_dev_commands/target_process/team.rb
|
383
398
|
- lib/firespring_dev_commands/target_process/team_assignment.rb
|
399
|
+
- lib/firespring_dev_commands/target_process/time.rb
|
384
400
|
- lib/firespring_dev_commands/target_process/user.rb
|
385
401
|
- lib/firespring_dev_commands/target_process/user_story.rb
|
386
402
|
- lib/firespring_dev_commands/target_process/user_story_history.rb
|
387
403
|
- lib/firespring_dev_commands/templates/aws.rb
|
404
|
+
- lib/firespring_dev_commands/templates/aws/services/route53.rb
|
388
405
|
- lib/firespring_dev_commands/templates/base_interface.rb
|
389
406
|
- lib/firespring_dev_commands/templates/certificate.rb
|
390
407
|
- lib/firespring_dev_commands/templates/ci.rb
|
@@ -413,9 +430,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
413
430
|
version: '3.1'
|
414
431
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
415
432
|
requirements:
|
416
|
-
- - "
|
433
|
+
- - ">="
|
417
434
|
- !ruby/object:Gem::Version
|
418
|
-
version:
|
435
|
+
version: '0'
|
419
436
|
requirements: []
|
420
437
|
rubygems_version: 3.4.10
|
421
438
|
signing_key:
|