Class: Dev::Aws::Route53
- Defined in:
- lib/firespring_dev_commands/aws/route53.rb
Overview
Class for performing Route53 functions
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #activate_query_logging(log_group) ⇒ Object
- #deactivate_query_logging ⇒ Object
-
#initialize(domains) ⇒ Route53
constructor
A new instance of Route53.
- #list_query_configs ⇒ Object
Constructor Details
#initialize(domains) ⇒ Route53
Returns a new instance of Route53.
7 8 9 10 |
# File 'lib/firespring_dev_commands/aws/route53.rb', line 7 def initialize(domains) @client = ::Aws::Route53::Client.new @domains = domains end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/firespring_dev_commands/aws/route53.rb', line 5 def client @client end |
Instance Method Details
#activate_query_logging(log_group) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/firespring_dev_commands/aws/route53.rb', line 73 def activate_query_logging(log_group) output = {} zones.each do |zone| response = client.create_query_logging_config( hosted_zone_id: zone.id, cloud_watch_logs_log_group_arn: log_group ) output[zone.id] = response.location rescue ::Aws::Route53::Errors::ServiceError => e raise "Error: #{e.}" unless e.instance_of?(::Aws::Route53::Errors::QueryLoggingConfigAlreadyExists) output[zone.id] = e. end pretty_puts(output) end |
#deactivate_query_logging ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/firespring_dev_commands/aws/route53.rb', line 90 def deactivate_query_logging output = {} zones.each do |zone| target_config_id = target_config_id(zone.id) if target_config_id client.delete_query_logging_config( id: target_config_id ) output[zone.id] = 'Query logging config removed.'.colorize(:green) else output[zone.id] = 'No query logging config assigned.'.colorize(:red) end end pretty_puts(output) end |
#list_query_configs ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/firespring_dev_commands/aws/route53.rb', line 58 def list_query_configs output = {} zones.each do |zone| target_config_id = target_config_id(zone.id) output[zone.name] = if target_config_id "Config\t=>\t#{target_config_id}".colorize(:green) else 'No query logging config assigned.'.colorize(:red) end end pretty_puts(output) end |