Class: AwsLogCleaner::CloudWatchLogs
- Inherits:
-
Object
- Object
- AwsLogCleaner::CloudWatchLogs
- Defined in:
- lib/aws_log_cleaner/cloud_watch_logs.rb
Overview
Class responsible for interacting with AWS Cloudwatch
Instance Method Summary collapse
- #delete_log_groups(log_group_names) ⇒ Object
-
#initialize(credentials) ⇒ CloudWatchLogs
constructor
A new instance of CloudWatchLogs.
- #list_all_log_groups ⇒ Object
Constructor Details
#initialize(credentials) ⇒ CloudWatchLogs
Returns a new instance of CloudWatchLogs.
9 10 11 12 13 14 |
# File 'lib/aws_log_cleaner/cloud_watch_logs.rb', line 9 def initialize(credentials) @cloud_watch_logs = Aws::CloudWatchLogs::Client.new( region: credentials.region, credentials: credentials.credentials ) end |
Instance Method Details
#delete_log_groups(log_group_names) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/aws_log_cleaner/cloud_watch_logs.rb', line 21 def delete_log_groups(log_group_names) log_group_names.each do |name| @cloud_watch_logs.delete_log_group( log_group_name: name ) end end |
#list_all_log_groups ⇒ Object
16 17 18 19 |
# File 'lib/aws_log_cleaner/cloud_watch_logs.rb', line 16 def list_all_log_groups @log_groups = describe_log_groups if @log_groups.nil? @log_groups end |