Class: Dogapi::V1::GcpIntegrationService

Inherits:
APIService
  • Object
show all
Defined in:
lib/dogapi/v1/gcp_integration.rb

Overview

GcpIntegrationService for user interaction with gcp 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

#gcp_integration_create(config) ⇒ Object

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

:type => 'service_account',
:project_id => '<PROJECT_ID>',
:private_key_id => '<PRIVATE_KEY_ID>',
:private_key => '<PRIVATE_KEY>',
:client_email => '<CLIENT_EMAIL>',
:client_id => '<CLIENT_ID>',
:auth_uri => '<AUTH_URI>',
:token_uri => '<TOKEN_URI>',
:auth_provider_x509_cert_url => '<AUTH_PROVIDER_X509_CERT_URL>',
:client_x509_cert_url => '<CLIENT_X509_CERT_URL>',
:host_filters => '<KEY>:<VALUE>,<KEY>:<VALUE>,'

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

puts dog.gcp_integration_create(config)



51
52
53
# File 'lib/dogapi/v1/gcp_integration.rb', line 51

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

#gcp_integration_delete(config) ⇒ Object

Delete an gcp integration :config => Hash: integration config. config =

:project_id => 'datadog-sandbox',
:client_email => '[email protected]'

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

puts dog.gcp_integration_delete(config)



28
29
30
# File 'lib/dogapi/v1/gcp_integration.rb', line 28

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

#gcp_integration_listObject

Retrieve gcp integration information



14
15
16
# File 'lib/dogapi/v1/gcp_integration.rb', line 14

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

#gcp_integration_update(config) ⇒ Object

Update a configured gcp account. :config => Hash: integration config. config =

:project_id => '<PROJECT_ID>',
:client_email => '<CLIENT_EMAIL>',
:host_filters => '<KEY>:<VALUE>,<KEY>:<VALUE>,'
:automute => true # takes a boolean and toggles GCE automuting

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

puts dog.gcp_integration_update(config)



67
68
69
# File 'lib/dogapi/v1/gcp_integration.rb', line 67

def gcp_integration_update(config)
  request(Net::HTTP::Put, "/api/#{API_VERSION}/integration/gcp", nil, config, true)
end