lib/aws_recon/options.rb in aws_recon-0.3.5 vs lib/aws_recon/options.rb in aws_recon-0.4.0
- old
+ new
@@ -4,19 +4,21 @@
# Command line options parser
#
class Parser
DEFAULT_CONFIG_FILE = nil
DEFAULT_OUTPUT_FILE = File.expand_path(File.join(Dir.pwd, 'output.json')).freeze
+ DEFAULT_S3_PATH = nil
SERVICES_CONFIG_FILE = File.join(File.dirname(__FILE__), 'services.yaml').freeze
DEFAULT_FORMAT = 'aws'
DEFAULT_THREADS = 8
MAX_THREADS = 128
Options = Struct.new(
:regions,
:services,
:config_file,
+ :s3,
:output_file,
:output_format,
:threads,
:collect_user_data,
:skip_slow,
@@ -41,10 +43,11 @@
args = Options.new(
aws_regions,
aws_services.map { |service| service[:name] },
DEFAULT_CONFIG_FILE,
+ DEFAULT_S3_PATH,
DEFAULT_OUTPUT_FILE,
DEFAULT_FORMAT,
DEFAULT_THREADS,
false,
false,
@@ -89,9 +92,14 @@
end
# config file
opts.on('-c', '--config [CONFIG]', 'Specify config file for services & regions (e.g. config.yaml)') do |config|
args.config_file = config
+ end
+
+ # write output file to S3 bucket
+ opts.on('-b', '--s3-bucket [BUCKET:REGION]', 'Write output file to S3 bucket (default: \'\')') do |bucket_with_region|
+ args.s3 = bucket_with_region
end
# output file
opts.on('-o', '--output [OUTPUT]', 'Specify output file (default: output.json)') do |output|
args.output_file = File.expand_path(File.join(Dir.pwd, output))