Class: Kybus::AWS::LogGroup
Instance Method Summary
collapse
Methods inherited from Resource
#account_id, #with_retries
Constructor Details
#initialize(config, name) ⇒ LogGroup
Returns a new instance of LogGroup.
6
7
8
9
|
# File 'lib/kybus/aws/log_group.rb', line 6
def initialize(config, name)
super(config)
@name = name
end
|
Instance Method Details
#create_or_update! ⇒ Object
19
20
21
22
23
24
|
# File 'lib/kybus/aws/log_group.rb', line 19
def create_or_update!
logs_client.create_log_group(log_group_name:)
puts "Log group '#{log_group_name}' created."
rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException
puts "Log group '#{log_group_name}' already exists."
end
|
#destroy! ⇒ Object
26
27
28
29
30
31
|
# File 'lib/kybus/aws/log_group.rb', line 26
def destroy!
logs_client.delete_log_group(log_group_name:)
puts "Log group '#{log_group_name}' deleted."
rescue Aws::CloudWatchLogs::Errors::ResourceNotFoundException
puts "Log group '#{log_group_name}' not found."
end
|
#log_group_name ⇒ Object
15
16
17
|
# File 'lib/kybus/aws/log_group.rb', line 15
def log_group_name
"/aws/lambda/#{@name}"
end
|
#logs_client ⇒ Object
11
12
13
|
# File 'lib/kybus/aws/log_group.rb', line 11
def logs_client
@logs_client ||= Aws::CloudWatchLogs::Client.new(region: @region)
end
|