Skip to content

Commit 1234f97

Browse files
committed
CRED-2151: Regenerated client code from templates
1 parent c9d8930 commit 1234f97

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/datadog_api_client/api_client.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def calculate_retry_interval(response, backoff_base, backoff_multiplier, attempt
154154
#Redact api and app key in the request header
155155
def sanitize_request_header(request_header)
156156
sanitized_headers= request_header.dup
157-
keys_to_redact = ["DD-API-KEY", "DD-APPLICATION-KEY"]
157+
keys_to_redact = ["DD-API-KEY", "DD-APPLICATION-KEY", "Authorization"]
158158
keys_to_redact.each do |key_to_redact|
159159
if sanitized_headers.key?(key_to_redact)
160160
sanitized_headers[key_to_redact] = "REDACTED"
@@ -380,6 +380,7 @@ def update_params_for_auth!(header_params, query_params, auth_names)
380380
Array(auth_names).each do |auth_name|
381381
auth_setting = @config.auth_settings[auth_name]
382382
next unless auth_setting
383+
next if auth_setting[:value].nil? || auth_setting[:value].to_s.empty?
383384
case auth_setting[:in]
384385
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
385386
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]

lib/datadog_api_client/configuration.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ def initialize
408408
@server_variables[:site] = ENV['DD_SITE'] if ENV.key? 'DD_SITE'
409409
@api_key['apiKeyAuth'] = ENV['DD_API_KEY'] if ENV.key? 'DD_API_KEY'
410410
@api_key['appKeyAuth'] = ENV['DD_APP_KEY'] if ENV.key? 'DD_APP_KEY'
411+
@access_token = ENV['DD_BEARER_TOKEN'] if ENV.key? 'DD_BEARER_TOKEN'
411412

412413
yield(self) if block_given?
413414
end
@@ -503,6 +504,13 @@ def auth_settings
503504
key: 'DD-APPLICATION-KEY',
504505
value: api_key_with_prefix('appKeyAuth')
505506
},
507+
bearerAuth:
508+
{
509+
type: 'http',
510+
in: 'header',
511+
key: 'Authorization',
512+
value: access_token ? "Bearer #{access_token}" : nil
513+
},
506514
}
507515
end
508516

0 commit comments

Comments
 (0)