Class: Dev::Template::Aws::Services::Route53

Inherits:
BaseInterface show all
Defined in:
lib/firespring_dev_commands/templates/aws/services/route53.rb

Overview

Class contains rake templates for managing your AWS settings and logging in

Instance Attribute Summary

Attributes inherited from BaseInterface

#exclude

Instance Method Summary collapse

Methods inherited from BaseInterface

#create_tasks!, #initialize

Constructor Details

This class inherits a constructor from Dev::Template::BaseInterface

Instance Method Details

#create_dns_logging_activate_task!Object

Create the rake task for the hosted zone method



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/firespring_dev_commands/templates/aws/services/route53.rb', line 29

def create_dns_logging_activate_task!
  # Have to set a local variable to be accessible inside of the instance_eval block
  exclude = @exclude

  DEV_COMMANDS_TOP_LEVEL.instance_eval do
    return if exclude.include?(:dns_logging_activate)

    namespace :aws do
      namespace :hosted_zone do
        namespace :dns_logging do
          desc 'Activates query logging for all hosted zones by default.' \
               'This command should be run from the account the hosted zone(s) reside.' \
               "\n\t(Required) Specify LOG_GROUP_ARN='arn:aws:logs:REGION:ACCOUNT_ID:' to specify the ARN of the target log group." \
               "\n\toptionally specify DOMAINS='foo.com,foobar.com' to specify the hosted zones to activate." \
               "\n\t\tComma delimited list."
          task activate: %w(ensure_aws_credentials) do
            route53 = Dev::Aws::Route53.new(ENV['DOMAINS'].to_s.strip.split(','))
            # Use user defined log group.
            log_group = ENV.fetch('LOG_GROUP_ARN', nil)
            raise 'The Hosted Zone Log Group ARN, LOG_GROUP_ARN, is required' unless log_group

            route53.activate_query_logging(log_group)
          end
        end
      end
    end
  end
end

#create_dns_logging_deactivate_task!Object

Create the rake task for the hosted zone method



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/firespring_dev_commands/templates/aws/services/route53.rb', line 59

def create_dns_logging_deactivate_task!
  # Have to set a local variable to be accessible inside of the instance_eval block
  exclude = @exclude

  DEV_COMMANDS_TOP_LEVEL.instance_eval do
    return if exclude.include?(:dns_logging_deactivate)

    namespace :aws do
      namespace :hosted_zone do
        namespace :dns_logging do
          desc 'Deactivates query logging for all hosted zones by default. ' \
               'This command should be run from the account the hosted zone(s) reside.' \
               "\n\toptionally specify DOMAINS='foo.com,foobar.com' to specify the hosted zones to activate." \
               "\n\t\tComma delimited list."
          task deactivate: %w(ensure_aws_credentials) do
            route53 = Dev::Aws::Route53.new(ENV['DOMAINS'].to_s.strip.split(','))
            route53.deactivate_query_logging
          end
        end
      end
    end
  end
end

#create_list_query_config_task!Object

Create the rake task for the hosted zone method



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/firespring_dev_commands/templates/aws/services/route53.rb', line 84

def create_list_query_config_task!
  # Have to set a local variable to be accessible inside of the instance_eval block
  exclude = @exclude

  DEV_COMMANDS_TOP_LEVEL.instance_eval do
    return if exclude.include?(:dns_logging_config)

    namespace :aws do
      namespace :hosted_zone do
        namespace :dns_logging do
          desc 'Lists the current config for domain(s). ' \
               'This command should be run from the account the hosted zone(s) reside.' \
               "\n\toptionally specify DOMAINS='foo.com,foobar.com' to specify the hosted zones to activate." \
               "\n\t\tComma delimited list."
          task list_query_configs: %w(ensure_aws_credentials) do
            route53 = Dev::Aws::Route53.new(ENV['DOMAINS'].to_s.strip.split(','))
            route53.list_query_configs
          end
        end
      end
    end
  end
end

#create_list_zone_details_task!Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/firespring_dev_commands/templates/aws/services/route53.rb', line 9

def create_list_zone_details_task!
  # Have to set a local variable to be accessible inside of the instance_eval block
  exclude = @exclude

  DEV_COMMANDS_TOP_LEVEL.instance_eval do
    return if exclude.include?(:list_details)

    namespace :aws do
      namespace :hosted_zone do
        desc 'print details for all hosted zones'
        task list_details: %w(ensure_aws_credentials) do
          route53 = Dev::Aws::Route53.new(ENV['DOMAINS'].to_s.strip.split(','))
          route53.list_zone_details
        end
      end
    end
  end
end