Class: Dogapi::V1::AwsLogsService

Inherits:
APIService show all
Defined in:
lib/dogapi/v1/aws_logs.rb

Overview

AwsLogsService for user interaction with AWS configs.

Constant Summary collapse

API_VERSION =
'v1'

Instance Attribute Summary

Attributes inherited from APIService

#api_key, #application_key

Instance Method Summary collapse

Methods inherited from APIService

#connect, #handle_redirect, #handle_response, #initialize, #prepare_params, #prepare_request, #request, #should_set_api_and_app_keys_in_params?, #suppress_error_if_silent

Constructor Details

This class inherits a constructor from Dogapi::APIService

Instance Method Details

#aws_logs_add_lambda(config) ⇒ Object

Create an AWS integration :config => Hash: integration config. config =

:account_id => '<AWS_ACCOUNT>',
:lambda_arn => '<LAMBDA_ARN>'

dog = Dogapi::Client.new(api_key, app_key)

puts dog.aws_logs_add_lambda(config)



30
31
32
# File 'lib/dogapi/v1/aws_logs.rb', line 30

def aws_logs_add_lambda(config)
  request(Net::HTTP::Post, "/api/#{API_VERSION}/integration/aws/logs", nil, config, true)
end

#aws_logs_check_lambda(config) ⇒ Object

contents of config should be >>> :account_id => ‘<AWS_ACCOUNT_ID>’ >>> :lambda_arn => ‘<AWS_LAMBDA_ARN>’



81
82
83
# File 'lib/dogapi/v1/aws_logs.rb', line 81

def aws_logs_check_lambda(config)
  request(Net::HTTP::Post, "/api/#{API_VERSION}/integration/aws/logs/check_async", nil, config, true)
end

#aws_logs_check_services(config) ⇒ Object

contents of config should be :account_id => ‘<AWS_ACCOUNT_ID>’ :services => [‘s3’, ‘elb’, ‘elbv2’, ‘cloudfront’, ‘redshift’, ‘lambda’]



98
99
100
# File 'lib/dogapi/v1/aws_logs.rb', line 98

def aws_logs_check_services(config)
  request(Net::HTTP::Post, "/api/#{API_VERSION}/integration/aws/logs/services_async", nil, config, true)
end

#aws_logs_integration_delete(config) ⇒ Object

Delete an AWS Logs integration :config => Hash: integration config. config =

:account_id => '<AWS_ACCOUNT>',
:lambda_arn => '<LAMBDA_ARN>'

dog = Dogapi::Client.new(api_key, app_key)

puts dog.aws_logs_integration_delete(config)



63
64
65
# File 'lib/dogapi/v1/aws_logs.rb', line 63

def aws_logs_integration_delete(config)
  request(Net::HTTP::Delete, "/api/#{API_VERSION}/integration/aws/logs", nil, config, true)
end

#aws_logs_integrations_listObject

List all Datadog-AWS Logs integrations configured in your Datadog account.



35
36
37
# File 'lib/dogapi/v1/aws_logs.rb', line 35

def aws_logs_integrations_list
  request(Net::HTTP::Get, "/api/#{API_VERSION}/integration/aws/logs", nil, nil, false)
end

#aws_logs_list_servicesObject

Get the list of current AWS services for which Datadog offers automatic log collection. Use returned service IDs with the services parameter for the Enable an AWS service log collection API endpoint.



16
17
18
# File 'lib/dogapi/v1/aws_logs.rb', line 16

def aws_logs_list_services
  request(Net::HTTP::Get, "/api/#{API_VERSION}/integration/aws/logs/services", nil, nil, false)
end

#aws_logs_save_services(config) ⇒ Object

Enable automatic log collection for a list of services. This should be run after running ‘aws_logs_add_lambda’ to save the config. config =

:account_id => '<AWS_ACCOUNT>',
:services => ['s3', 'elb', 'elbv2', 'cloudfront', 'redshift', 'lambda']

dog = Dogapi::Client.new(api_key, app_key)

puts dog.aws_logs_save_services(config)



49
50
51
# File 'lib/dogapi/v1/aws_logs.rb', line 49

def aws_logs_save_services(config)
  request(Net::HTTP::Post, "/api/#{API_VERSION}/integration/aws/logs/services", nil, config, true)
end