diff --git a/.generator/src/generator/templates/api.j2 b/.generator/src/generator/templates/api.j2 index 33028a8ff0..4dcfcd957a 100644 --- a/.generator/src/generator/templates/api.j2 +++ b/.generator/src/generator/templates/api.j2 @@ -384,19 +384,14 @@ impl {{ structName }} { }; // build auth - {%- set authMethods = operation.security if "security" in operation else openapi.security %} - {%- if authMethods %} - {%- for authMethod in authMethods %} - {%- for name in authMethod %} - {%- set schema = openapi.components.securitySchemes[name] %} - {%- if schema.type == "apiKey" and schema.in != "cookie" %} - if let Some(local_key) = local_configuration.auth_keys.get("{{ name }}") { - headers.insert("{{schema.name}}", HeaderValue::from_str(local_key.key.as_str()).expect("failed to parse {{schema.name}} header")); - }; - {%- endif %} - {%- endfor %} - {%- endfor %} - {%- endif %} + for (key, value) in local_configuration.auth_headers() { + headers.insert( + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), + ); + } {% if formParameter %} // build form parameters diff --git a/.generator/src/generator/templates/configuration.j2 b/.generator/src/generator/templates/configuration.j2 index e2bde78a0b..84f86bf1c0 100644 --- a/.generator/src/generator/templates/configuration.j2 +++ b/.generator/src/generator/templates/configuration.j2 @@ -44,6 +44,9 @@ pub struct Configuration { pub(crate) user_agent: String, pub(crate) unstable_operations: HashMap, pub(crate) auth_keys: HashMap, + {%- if "bearerAuth" in openapi.components.securitySchemes %} + pub(crate) pat: Option, + {%- endif %} pub server_index: usize, pub server_variables: HashMap, pub server_operation_index: HashMap, @@ -106,6 +109,40 @@ impl Configuration { self.auth_keys.insert(operation_str.to_string(), api_key); } + {%- if "bearerAuth" in openapi.components.securitySchemes %} + + /// Set a bearer token for authentication. + pub fn set_pat(&mut self, pat: String) { + self.pat = Some(pat); + } + + {%- endif %} + + /// Build authentication headers for an API request. + /// All configured auth credentials are sent; the server decides which to use. + pub fn auth_headers(&self) -> Vec<(String, String)> { + let mut headers = Vec::new(); + {%- if "bearerAuth" in openapi.components.securitySchemes %} + if let Some(ref pat) = self.pat { + headers.push(("Authorization".to_string(), format!("Bearer {}", pat))); + } + {%- endif %} + {%- set authMethods = openapi.security %} + {%- if authMethods %} + {%- for authMethod in authMethods %} + {%- for name in authMethod %} + {%- set schema = openapi.components.securitySchemes[name] %} + {%- if schema.type == "apiKey" and schema.in != "cookie" %} + if let Some(key) = self.auth_keys.get("{{ name }}") { + headers.push(("{{ schema.name }}".to_string(), key.key.clone())); + } + {%- endif %} + {%- endfor %} + {%- endfor %} + {%- endif %} + headers + } + pub fn set_proxy_url(&mut self, proxy_url: Option) { self.proxy_url = proxy_url; } @@ -149,10 +186,20 @@ impl Default for Configuration { {%- endfor %} {%- endif %} + {%- if "bearerAuth" in openapi.components.securitySchemes %} + {%- set bearerEnvName = openapi.components.securitySchemes.bearerAuth["x-env-name"] %} + + // {{ bearerEnvName }} env var enables Bearer token auth (mutually exclusive with API key auth) + let pat = env::var("{{ bearerEnvName }}").ok().filter(|p| !p.is_empty()); + {%- endif %} + Self { user_agent: DEFAULT_USER_AGENT.clone(), unstable_operations, auth_keys, + {%- if "bearerAuth" in openapi.components.securitySchemes %} + pat, + {%- endif %} server_index: 0, server_variables: HashMap::from([( "site".into(), diff --git a/src/datadog/configuration.rs b/src/datadog/configuration.rs index cb1af62305..f704e4417b 100644 --- a/src/datadog/configuration.rs +++ b/src/datadog/configuration.rs @@ -46,6 +46,7 @@ pub struct Configuration { pub(crate) user_agent: String, pub(crate) unstable_operations: HashMap, pub(crate) auth_keys: HashMap, + pub(crate) pat: Option, pub server_index: usize, pub server_variables: HashMap, pub server_operation_index: HashMap, @@ -109,6 +110,27 @@ impl Configuration { self.auth_keys.insert(operation_str.to_string(), api_key); } + /// Set a bearer token for authentication. + pub fn set_pat(&mut self, pat: String) { + self.pat = Some(pat); + } + + /// Build authentication headers for an API request. + /// All configured auth credentials are sent; the server decides which to use. + pub fn auth_headers(&self) -> Vec<(String, String)> { + let mut headers = Vec::new(); + if let Some(ref pat) = self.pat { + headers.push(("Authorization".to_string(), format!("Bearer {}", pat))); + } + if let Some(key) = self.auth_keys.get("apiKeyAuth") { + headers.push(("DD-API-KEY".to_string(), key.key.clone())); + } + if let Some(key) = self.auth_keys.get("appKeyAuth") { + headers.push(("DD-APPLICATION-KEY".to_string(), key.key.clone())); + } + headers + } + pub fn set_proxy_url(&mut self, proxy_url: Option) { self.proxy_url = proxy_url; } @@ -363,10 +385,14 @@ impl Default for Configuration { }, ); + // DD_BEARER_TOKEN env var enables Bearer token auth (mutually exclusive with API key auth) + let pat = env::var("DD_BEARER_TOKEN").ok().filter(|p| !p.is_empty()); + Self { user_agent: DEFAULT_USER_AGENT.clone(), unstable_operations, auth_keys, + pat, server_index: 0, server_variables: HashMap::from([( "site".into(), diff --git a/src/datadogV1/api/api_authentication.rs b/src/datadogV1/api/api_authentication.rs index 29049cd166..4b8ea2ada3 100644 --- a/src/datadogV1/api/api_authentication.rs +++ b/src/datadogV1/api/api_authentication.rs @@ -143,13 +143,14 @@ impl AuthenticationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV1/api/api_aws_integration.rs b/src/datadogV1/api/api_aws_integration.rs index fe821b7caf..f8d77f2713 100644 --- a/src/datadogV1/api/api_aws_integration.rs +++ b/src/datadogV1/api/api_aws_integration.rs @@ -302,20 +302,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -459,20 +453,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -613,20 +601,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -767,20 +749,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -921,20 +897,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1078,20 +1048,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1232,20 +1196,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1401,20 +1359,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1507,20 +1459,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1617,20 +1563,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1720,20 +1660,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1847,20 +1781,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_aws_logs_integration.rs b/src/datadogV1/api/api_aws_logs_integration.rs index 63ba2e0ad6..011bf2d79d 100644 --- a/src/datadogV1/api/api_aws_logs_integration.rs +++ b/src/datadogV1/api/api_aws_logs_integration.rs @@ -206,20 +206,14 @@ impl AWSLogsIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -381,20 +375,14 @@ impl AWSLogsIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -535,20 +523,14 @@ impl AWSLogsIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -689,20 +671,14 @@ impl AWSLogsIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -843,20 +819,14 @@ impl AWSLogsIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -994,20 +964,14 @@ impl AWSLogsIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1100,20 +1064,14 @@ impl AWSLogsIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV1/api/api_azure_integration.rs b/src/datadogV1/api/api_azure_integration.rs index 6516c4292b..951ca436b8 100644 --- a/src/datadogV1/api/api_azure_integration.rs +++ b/src/datadogV1/api/api_azure_integration.rs @@ -188,20 +188,14 @@ impl AzureIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -342,20 +336,14 @@ impl AzureIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -491,20 +479,14 @@ impl AzureIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -599,20 +581,14 @@ impl AzureIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -757,20 +733,14 @@ impl AzureIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_dashboard_lists.rs b/src/datadogV1/api/api_dashboard_lists.rs index 0b66a5da94..8645cc7fb1 100644 --- a/src/datadogV1/api/api_dashboard_lists.rs +++ b/src/datadogV1/api/api_dashboard_lists.rs @@ -175,20 +175,14 @@ impl DashboardListsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -327,20 +321,14 @@ impl DashboardListsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -433,20 +421,14 @@ impl DashboardListsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -537,20 +519,14 @@ impl DashboardListsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -650,20 +626,14 @@ impl DashboardListsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_dashboards.rs b/src/datadogV1/api/api_dashboards.rs index 5bcf28f7bb..9ca2f81da9 100644 --- a/src/datadogV1/api/api_dashboards.rs +++ b/src/datadogV1/api/api_dashboards.rs @@ -312,20 +312,14 @@ impl DashboardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -462,20 +456,14 @@ impl DashboardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -614,20 +602,14 @@ impl DashboardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -709,20 +691,14 @@ impl DashboardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -856,20 +832,14 @@ impl DashboardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -958,20 +928,14 @@ impl DashboardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1102,20 +1066,14 @@ impl DashboardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1206,20 +1164,14 @@ impl DashboardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1331,20 +1283,14 @@ impl DashboardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1504,20 +1450,14 @@ impl DashboardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1598,20 +1538,14 @@ impl DashboardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1751,20 +1685,14 @@ impl DashboardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1908,20 +1836,14 @@ impl DashboardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -2064,20 +1986,14 @@ impl DashboardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_downtimes.rs b/src/datadogV1/api/api_downtimes.rs index cd2a401b19..f1829fe065 100644 --- a/src/datadogV1/api/api_downtimes.rs +++ b/src/datadogV1/api/api_downtimes.rs @@ -205,20 +205,14 @@ impl DowntimesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -307,20 +301,14 @@ impl DowntimesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -458,20 +446,14 @@ impl DowntimesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -607,20 +589,14 @@ impl DowntimesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -722,20 +698,14 @@ impl DowntimesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -827,20 +797,14 @@ impl DowntimesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -934,20 +898,14 @@ impl DowntimesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_events.rs b/src/datadogV1/api/api_events.rs index 8dcfbdc49a..f1a4baf00b 100644 --- a/src/datadogV1/api/api_events.rs +++ b/src/datadogV1/api/api_events.rs @@ -220,13 +220,14 @@ impl EventsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -369,20 +370,14 @@ impl EventsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -526,20 +521,14 @@ impl EventsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV1/api/api_gcp_integration.rs b/src/datadogV1/api/api_gcp_integration.rs index 76c8a925ba..08b4f6bccd 100644 --- a/src/datadogV1/api/api_gcp_integration.rs +++ b/src/datadogV1/api/api_gcp_integration.rs @@ -168,20 +168,14 @@ impl GCPIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -322,20 +316,14 @@ impl GCPIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -471,20 +459,14 @@ impl GCPIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -584,20 +566,14 @@ impl GCPIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_hosts.rs b/src/datadogV1/api/api_hosts.rs index 208768374e..cb284c74cb 100644 --- a/src/datadogV1/api/api_hosts.rs +++ b/src/datadogV1/api/api_hosts.rs @@ -254,20 +254,14 @@ impl HostsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -410,20 +404,14 @@ impl HostsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -517,20 +505,14 @@ impl HostsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -666,20 +648,14 @@ impl HostsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV1/api/api_key_management.rs b/src/datadogV1/api/api_key_management.rs index e7eba4ba08..796ea15771 100644 --- a/src/datadogV1/api/api_key_management.rs +++ b/src/datadogV1/api/api_key_management.rs @@ -218,20 +218,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -371,20 +365,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -522,20 +510,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -630,20 +612,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -736,20 +712,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -844,20 +814,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -947,20 +911,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1054,20 +1012,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1163,20 +1115,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1319,20 +1265,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_logs.rs b/src/datadogV1/api/api_logs.rs index e7b132d6af..e10ca5e876 100644 --- a/src/datadogV1/api/api_logs.rs +++ b/src/datadogV1/api/api_logs.rs @@ -189,20 +189,14 @@ impl LogsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -396,13 +390,14 @@ impl LogsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_logs_indexes.rs b/src/datadogV1/api/api_logs_indexes.rs index 4aade2f955..c1f51d5c2f 100644 --- a/src/datadogV1/api/api_logs_indexes.rs +++ b/src/datadogV1/api/api_logs_indexes.rs @@ -194,20 +194,14 @@ impl LogsIndexesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -334,20 +328,14 @@ impl LogsIndexesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -433,20 +421,14 @@ impl LogsIndexesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -534,20 +516,14 @@ impl LogsIndexesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -639,20 +615,14 @@ impl LogsIndexesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -756,20 +726,14 @@ impl LogsIndexesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -908,20 +872,14 @@ impl LogsIndexesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_logs_pipelines.rs b/src/datadogV1/api/api_logs_pipelines.rs index cc44f0e3b3..8bd3fee05d 100644 --- a/src/datadogV1/api/api_logs_pipelines.rs +++ b/src/datadogV1/api/api_logs_pipelines.rs @@ -214,20 +214,14 @@ impl LogsPipelinesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -354,20 +348,14 @@ impl LogsPipelinesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -455,20 +443,14 @@ impl LogsPipelinesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -561,20 +543,14 @@ impl LogsPipelinesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -667,20 +643,14 @@ impl LogsPipelinesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -785,20 +755,14 @@ impl LogsPipelinesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -945,20 +909,14 @@ impl LogsPipelinesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_metrics.rs b/src/datadogV1/api/api_metrics.rs index b18058892d..f8fda34f14 100644 --- a/src/datadogV1/api/api_metrics.rs +++ b/src/datadogV1/api/api_metrics.rs @@ -268,20 +268,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -388,20 +382,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -500,20 +488,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -613,20 +595,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -739,13 +715,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -919,13 +896,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1070,20 +1048,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_monitors.rs b/src/datadogV1/api/api_monitors.rs index 063a90655a..75d2859559 100644 --- a/src/datadogV1/api/api_monitors.rs +++ b/src/datadogV1/api/api_monitors.rs @@ -468,20 +468,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1034,20 +1028,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1193,20 +1181,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1317,20 +1299,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1495,20 +1471,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1623,20 +1593,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1752,20 +1716,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1861,20 +1819,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -2019,20 +1971,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -2177,20 +2123,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_notebooks.rs b/src/datadogV1/api/api_notebooks.rs index 8067ee318e..c250bbb72c 100644 --- a/src/datadogV1/api/api_notebooks.rs +++ b/src/datadogV1/api/api_notebooks.rs @@ -256,20 +256,14 @@ impl NotebooksAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -395,20 +389,14 @@ impl NotebooksAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -494,20 +482,14 @@ impl NotebooksAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -691,20 +673,14 @@ impl NotebooksAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -800,20 +776,14 @@ impl NotebooksAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_organizations.rs b/src/datadogV1/api/api_organizations.rs index 28b8cdb35b..e993c5e074 100644 --- a/src/datadogV1/api/api_organizations.rs +++ b/src/datadogV1/api/api_organizations.rs @@ -201,20 +201,14 @@ impl OrganizationsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -353,20 +347,14 @@ impl OrganizationsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -458,20 +446,14 @@ impl OrganizationsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -561,20 +543,14 @@ impl OrganizationsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -669,20 +645,14 @@ impl OrganizationsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -838,20 +808,14 @@ impl OrganizationsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build form parameters let mut local_form = form_data_builder::FormData::new(Vec::new()); diff --git a/src/datadogV1/api/api_pager_duty_integration.rs b/src/datadogV1/api/api_pager_duty_integration.rs index 6893e045ac..867d69f1d6 100644 --- a/src/datadogV1/api/api_pager_duty_integration.rs +++ b/src/datadogV1/api/api_pager_duty_integration.rs @@ -171,20 +171,14 @@ impl PagerDutyIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -315,20 +309,14 @@ impl PagerDutyIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -420,20 +408,14 @@ impl PagerDutyIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -522,20 +504,14 @@ impl PagerDutyIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_security_monitoring.rs b/src/datadogV1/api/api_security_monitoring.rs index a10b7136df..ce4f5a1554 100644 --- a/src/datadogV1/api/api_security_monitoring.rs +++ b/src/datadogV1/api/api_security_monitoring.rs @@ -165,20 +165,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -325,20 +319,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -485,20 +473,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_service_checks.rs b/src/datadogV1/api/api_service_checks.rs index 959ddc1eea..162099007c 100644 --- a/src/datadogV1/api/api_service_checks.rs +++ b/src/datadogV1/api/api_service_checks.rs @@ -167,13 +167,14 @@ impl ServiceChecksAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_service_level_objective_corrections.rs b/src/datadogV1/api/api_service_level_objective_corrections.rs index a5c65d42e0..78861611b1 100644 --- a/src/datadogV1/api/api_service_level_objective_corrections.rs +++ b/src/datadogV1/api/api_service_level_objective_corrections.rs @@ -203,20 +203,14 @@ impl ServiceLevelObjectiveCorrectionsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -346,20 +340,14 @@ impl ServiceLevelObjectiveCorrectionsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -449,20 +437,14 @@ impl ServiceLevelObjectiveCorrectionsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -608,20 +590,14 @@ impl ServiceLevelObjectiveCorrectionsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -723,20 +699,14 @@ impl ServiceLevelObjectiveCorrectionsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_service_level_objectives.rs b/src/datadogV1/api/api_service_level_objectives.rs index ed6da1f217..d46909de3c 100644 --- a/src/datadogV1/api/api_service_level_objectives.rs +++ b/src/datadogV1/api/api_service_level_objectives.rs @@ -376,20 +376,14 @@ impl ServiceLevelObjectivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -482,20 +476,14 @@ impl ServiceLevelObjectivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -646,20 +634,14 @@ impl ServiceLevelObjectivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -761,20 +743,14 @@ impl ServiceLevelObjectivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -922,20 +898,14 @@ impl ServiceLevelObjectivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1028,20 +998,14 @@ impl ServiceLevelObjectivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1173,20 +1137,14 @@ impl ServiceLevelObjectivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1348,20 +1306,14 @@ impl ServiceLevelObjectivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1473,20 +1425,14 @@ impl ServiceLevelObjectivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1580,20 +1526,14 @@ impl ServiceLevelObjectivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_slack_integration.rs b/src/datadogV1/api/api_slack_integration.rs index ca5cb8e4e5..ca49fc0795 100644 --- a/src/datadogV1/api/api_slack_integration.rs +++ b/src/datadogV1/api/api_slack_integration.rs @@ -182,20 +182,14 @@ impl SlackIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -343,20 +337,14 @@ impl SlackIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -455,20 +443,14 @@ impl SlackIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -558,20 +540,14 @@ impl SlackIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -670,20 +646,14 @@ impl SlackIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_snapshots.rs b/src/datadogV1/api/api_snapshots.rs index 280bdfaa9b..d4fc5865f7 100644 --- a/src/datadogV1/api/api_snapshots.rs +++ b/src/datadogV1/api/api_snapshots.rs @@ -235,20 +235,14 @@ impl SnapshotsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV1/api/api_synthetics.rs b/src/datadogV1/api/api_synthetics.rs index 180aaaa3ad..3e1dd7225a 100644 --- a/src/datadogV1/api/api_synthetics.rs +++ b/src/datadogV1/api/api_synthetics.rs @@ -551,20 +551,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -707,20 +701,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -862,20 +850,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1018,20 +1000,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1175,20 +1151,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1318,20 +1288,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1409,20 +1373,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1511,20 +1469,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1670,20 +1622,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1822,20 +1768,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1974,20 +1914,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2107,20 +2041,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2223,20 +2151,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2332,20 +2254,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2467,20 +2383,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2583,20 +2493,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2692,20 +2596,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2801,20 +2699,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2910,20 +2802,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3019,20 +2905,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3122,20 +3002,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3229,20 +3103,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3334,20 +3202,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3441,20 +3303,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3597,20 +3453,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3706,20 +3556,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -3891,20 +3735,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3999,20 +3837,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -4153,20 +3985,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -4307,20 +4133,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -4466,20 +4286,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -4624,20 +4438,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -4784,20 +4592,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -4938,20 +4740,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_tags.rs b/src/datadogV1/api/api_tags.rs index 60b6d2e536..29b438395b 100644 --- a/src/datadogV1/api/api_tags.rs +++ b/src/datadogV1/api/api_tags.rs @@ -280,20 +280,14 @@ impl TagsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -433,20 +427,14 @@ impl TagsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -542,20 +530,14 @@ impl TagsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -652,20 +634,14 @@ impl TagsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -773,20 +749,14 @@ impl TagsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_usage_metering.rs b/src/datadogV1/api/api_usage_metering.rs index 99fa085649..8a1e96e531 100644 --- a/src/datadogV1/api/api_usage_metering.rs +++ b/src/datadogV1/api/api_usage_metering.rs @@ -1232,20 +1232,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1412,20 +1406,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1544,20 +1532,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1676,20 +1658,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1814,20 +1790,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2000,20 +1970,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2119,20 +2083,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2238,20 +2196,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2370,20 +2322,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2502,20 +2448,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2632,20 +2572,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2761,20 +2695,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2887,20 +2815,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3019,20 +2941,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3146,20 +3062,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3274,20 +3184,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3401,20 +3305,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3533,20 +3431,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3665,20 +3557,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3791,20 +3677,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3917,20 +3797,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4051,20 +3925,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4183,20 +4051,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4315,20 +4177,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4447,20 +4303,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4579,20 +4429,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4711,20 +4555,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4848,20 +4686,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4978,20 +4810,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -5104,20 +4930,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -5228,20 +5048,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -5368,20 +5182,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -5500,20 +5308,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -5632,20 +5434,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -5764,20 +5560,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -5896,20 +5686,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -6040,20 +5824,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV1/api/api_users.rs b/src/datadogV1/api/api_users.rs index ca27e4869b..00c5d95dd4 100644 --- a/src/datadogV1/api/api_users.rs +++ b/src/datadogV1/api/api_users.rs @@ -178,20 +178,14 @@ impl UsersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -333,20 +327,14 @@ impl UsersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -438,20 +426,14 @@ impl UsersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -538,20 +520,14 @@ impl UsersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -649,20 +625,14 @@ impl UsersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV1/api/api_webhooks_integration.rs b/src/datadogV1/api/api_webhooks_integration.rs index 49f7ad86fd..1a9a89eae5 100644 --- a/src/datadogV1/api/api_webhooks_integration.rs +++ b/src/datadogV1/api/api_webhooks_integration.rs @@ -200,20 +200,14 @@ impl WebhooksIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -359,20 +353,14 @@ impl WebhooksIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -503,20 +491,14 @@ impl WebhooksIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -597,20 +579,14 @@ impl WebhooksIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -702,20 +678,14 @@ impl WebhooksIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -822,20 +792,14 @@ impl WebhooksIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -938,20 +902,14 @@ impl WebhooksIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1100,20 +1058,14 @@ impl WebhooksIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_action_connection.rs b/src/datadogV2/api/api_action_connection.rs index 1b3c8d5b51..c5c7f86726 100644 --- a/src/datadogV2/api/api_action_connection.rs +++ b/src/datadogV2/api/api_action_connection.rs @@ -229,20 +229,14 @@ impl ActionConnectionAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -372,20 +366,14 @@ impl ActionConnectionAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -477,20 +465,14 @@ impl ActionConnectionAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -589,20 +571,14 @@ impl ActionConnectionAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -710,20 +686,14 @@ impl ActionConnectionAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -817,20 +787,14 @@ impl ActionConnectionAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -912,20 +876,14 @@ impl ActionConnectionAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1020,20 +978,14 @@ impl ActionConnectionAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_actions_datastores.rs b/src/datadogV2/api/api_actions_datastores.rs index 144ccd2ff2..c7fd4db804 100644 --- a/src/datadogV2/api/api_actions_datastores.rs +++ b/src/datadogV2/api/api_actions_datastores.rs @@ -275,20 +275,14 @@ impl ActionsDatastoresAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -436,20 +430,14 @@ impl ActionsDatastoresAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -590,20 +578,14 @@ impl ActionsDatastoresAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -730,20 +712,14 @@ impl ActionsDatastoresAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -838,20 +814,14 @@ impl ActionsDatastoresAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -989,20 +959,14 @@ impl ActionsDatastoresAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1126,20 +1090,14 @@ impl ActionsDatastoresAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1229,20 +1187,14 @@ impl ActionsDatastoresAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1339,20 +1291,14 @@ impl ActionsDatastoresAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1495,20 +1441,14 @@ impl ActionsDatastoresAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_agentless_scanning.rs b/src/datadogV2/api/api_agentless_scanning.rs index bcc069c1b8..43abe6bf7d 100644 --- a/src/datadogV2/api/api_agentless_scanning.rs +++ b/src/datadogV2/api/api_agentless_scanning.rs @@ -283,20 +283,14 @@ impl AgentlessScanningAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -437,20 +431,14 @@ impl AgentlessScanningAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -591,20 +579,14 @@ impl AgentlessScanningAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -742,20 +724,14 @@ impl AgentlessScanningAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -883,20 +859,14 @@ impl AgentlessScanningAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -974,20 +944,14 @@ impl AgentlessScanningAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1065,20 +1029,14 @@ impl AgentlessScanningAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1165,20 +1123,14 @@ impl AgentlessScanningAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1274,20 +1226,14 @@ impl AgentlessScanningAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1384,20 +1330,14 @@ impl AgentlessScanningAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1490,20 +1430,14 @@ impl AgentlessScanningAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1594,20 +1528,14 @@ impl AgentlessScanningAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1700,20 +1628,14 @@ impl AgentlessScanningAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1806,20 +1728,14 @@ impl AgentlessScanningAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1910,20 +1826,14 @@ impl AgentlessScanningAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2011,20 +1921,14 @@ impl AgentlessScanningAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -2164,20 +2068,14 @@ impl AgentlessScanningAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -2321,20 +2219,14 @@ impl AgentlessScanningAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_api_management.rs b/src/datadogV2/api/api_api_management.rs index 24e2e2f334..c1c59f28f5 100644 --- a/src/datadogV2/api/api_api_management.rs +++ b/src/datadogV2/api/api_api_management.rs @@ -256,20 +256,14 @@ impl APIManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build form parameters if let Some(openapi_spec_file) = openapi_spec_file { @@ -382,20 +376,14 @@ impl APIManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -486,20 +474,14 @@ impl APIManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -609,20 +591,14 @@ impl APIManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -733,20 +709,14 @@ impl APIManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build form parameters if let Some(openapi_spec_file) = openapi_spec_file { diff --git a/src/datadogV2/api/api_apm.rs b/src/datadogV2/api/api_apm.rs index 3b3aec354f..d7a9b7dfbd 100644 --- a/src/datadogV2/api/api_apm.rs +++ b/src/datadogV2/api/api_apm.rs @@ -134,20 +134,14 @@ impl APMAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_apm_retention_filters.rs b/src/datadogV2/api/api_apm_retention_filters.rs index f87fdfb8a1..8beee52352 100644 --- a/src/datadogV2/api/api_apm_retention_filters.rs +++ b/src/datadogV2/api/api_apm_retention_filters.rs @@ -189,20 +189,14 @@ impl APMRetentionFiltersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -336,20 +330,14 @@ impl APMRetentionFiltersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -441,20 +429,14 @@ impl APMRetentionFiltersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -547,20 +529,14 @@ impl APMRetentionFiltersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -645,20 +621,14 @@ impl APMRetentionFiltersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -802,20 +772,14 @@ impl APMRetentionFiltersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_app_builder.rs b/src/datadogV2/api/api_app_builder.rs index 65e9c16afe..6d4c5fe19d 100644 --- a/src/datadogV2/api/api_app_builder.rs +++ b/src/datadogV2/api/api_app_builder.rs @@ -306,20 +306,14 @@ impl AppBuilderAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -455,20 +449,14 @@ impl AppBuilderAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -559,20 +547,14 @@ impl AppBuilderAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -719,20 +701,14 @@ impl AppBuilderAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -886,20 +862,14 @@ impl AppBuilderAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -990,20 +960,14 @@ impl AppBuilderAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1096,20 +1060,14 @@ impl AppBuilderAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1204,20 +1162,14 @@ impl AppBuilderAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_application_security.rs b/src/datadogV2/api/api_application_security.rs index 4e547d6f1b..7bd0e9e322 100644 --- a/src/datadogV2/api/api_application_security.rs +++ b/src/datadogV2/api/api_application_security.rs @@ -223,20 +223,14 @@ impl ApplicationSecurityAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -389,20 +383,14 @@ impl ApplicationSecurityAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -536,20 +524,14 @@ impl ApplicationSecurityAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -630,20 +612,14 @@ impl ApplicationSecurityAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -735,20 +711,14 @@ impl ApplicationSecurityAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -850,20 +820,14 @@ impl ApplicationSecurityAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -962,20 +926,14 @@ impl ApplicationSecurityAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1074,20 +1032,14 @@ impl ApplicationSecurityAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1192,20 +1144,14 @@ impl ApplicationSecurityAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1360,20 +1306,14 @@ impl ApplicationSecurityAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_audit.rs b/src/datadogV2/api/api_audit.rs index 26eba75161..66e192705b 100644 --- a/src/datadogV2/api/api_audit.rs +++ b/src/datadogV2/api/api_audit.rs @@ -297,20 +297,14 @@ impl AuditAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -463,20 +457,14 @@ impl AuditAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_authn_mappings.rs b/src/datadogV2/api/api_authn_mappings.rs index 51ebc49d4d..d66811d1e5 100644 --- a/src/datadogV2/api/api_authn_mappings.rs +++ b/src/datadogV2/api/api_authn_mappings.rs @@ -224,20 +224,14 @@ impl AuthNMappingsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -367,20 +361,14 @@ impl AuthNMappingsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -470,20 +458,14 @@ impl AuthNMappingsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -606,20 +588,14 @@ impl AuthNMappingsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -721,20 +697,14 @@ impl AuthNMappingsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_aws_integration.rs b/src/datadogV2/api/api_aws_integration.rs index d6cda8e426..57556d5d8b 100644 --- a/src/datadogV2/api/api_aws_integration.rs +++ b/src/datadogV2/api/api_aws_integration.rs @@ -256,20 +256,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -413,20 +407,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -564,20 +552,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -662,20 +644,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -767,20 +743,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -922,20 +892,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1031,20 +995,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1141,20 +1099,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1251,20 +1203,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1366,20 +1312,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1472,20 +1412,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1578,20 +1512,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1691,20 +1619,14 @@ impl AWSIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_aws_logs_integration.rs b/src/datadogV2/api/api_aws_logs_integration.rs index a2eaa17750..01a60eb3ed 100644 --- a/src/datadogV2/api/api_aws_logs_integration.rs +++ b/src/datadogV2/api/api_aws_logs_integration.rs @@ -136,20 +136,14 @@ impl AWSLogsIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_case_management.rs b/src/datadogV2/api/api_case_management.rs index 93c4c2bea5..566d1e457d 100644 --- a/src/datadogV2/api/api_case_management.rs +++ b/src/datadogV2/api/api_case_management.rs @@ -445,20 +445,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -596,20 +590,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -747,20 +735,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -896,20 +878,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1047,20 +1023,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1194,20 +1164,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1341,20 +1305,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1485,20 +1443,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1643,20 +1595,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1789,20 +1735,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1895,20 +1835,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1988,20 +1922,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2083,20 +2011,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2182,20 +2104,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2285,20 +2201,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2394,20 +2304,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2497,20 +2401,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2612,20 +2510,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -2763,20 +2655,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -2921,20 +2807,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -3130,20 +3010,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3236,20 +3110,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -3388,20 +3256,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -3533,20 +3395,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3635,20 +3491,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -3794,20 +3644,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -3950,20 +3794,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -4102,20 +3940,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -4254,20 +4086,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -4406,20 +4232,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -4554,20 +4374,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -4701,20 +4515,14 @@ impl CaseManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_case_management_attribute.rs b/src/datadogV2/api/api_case_management_attribute.rs index e7b5408afc..b05469e126 100644 --- a/src/datadogV2/api/api_case_management_attribute.rs +++ b/src/datadogV2/api/api_case_management_attribute.rs @@ -173,20 +173,14 @@ impl CaseManagementAttributeAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -320,20 +314,14 @@ impl CaseManagementAttributeAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -425,20 +413,14 @@ impl CaseManagementAttributeAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -531,20 +513,14 @@ impl CaseManagementAttributeAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_case_management_type.rs b/src/datadogV2/api/api_case_management_type.rs index 4553021750..0a9ad32481 100644 --- a/src/datadogV2/api/api_case_management_type.rs +++ b/src/datadogV2/api/api_case_management_type.rs @@ -157,20 +157,14 @@ impl CaseManagementTypeAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -296,20 +290,14 @@ impl CaseManagementTypeAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -393,20 +381,14 @@ impl CaseManagementTypeAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_change_management.rs b/src/datadogV2/api/api_change_management.rs index 7a2d8f8355..043e7249ef 100644 --- a/src/datadogV2/api/api_change_management.rs +++ b/src/datadogV2/api/api_change_management.rs @@ -198,20 +198,14 @@ impl ChangeManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -366,20 +360,14 @@ impl ChangeManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -535,20 +523,14 @@ impl ChangeManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -653,20 +635,14 @@ impl ChangeManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -776,20 +752,14 @@ impl ChangeManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -948,20 +918,14 @@ impl ChangeManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_ci_visibility_pipelines.rs b/src/datadogV2/api/api_ci_visibility_pipelines.rs index 2e6e208e1d..ed6e631839 100644 --- a/src/datadogV2/api/api_ci_visibility_pipelines.rs +++ b/src/datadogV2/api/api_ci_visibility_pipelines.rs @@ -237,20 +237,14 @@ impl CIVisibilityPipelinesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -402,13 +396,14 @@ impl CIVisibilityPipelinesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -632,20 +627,14 @@ impl CIVisibilityPipelinesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -797,20 +786,14 @@ impl CIVisibilityPipelinesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_ci_visibility_tests.rs b/src/datadogV2/api/api_ci_visibility_tests.rs index 490f6c5302..b1b122806c 100644 --- a/src/datadogV2/api/api_ci_visibility_tests.rs +++ b/src/datadogV2/api/api_ci_visibility_tests.rs @@ -226,20 +226,14 @@ impl CIVisibilityTestsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -461,20 +455,14 @@ impl CIVisibilityTestsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -623,20 +611,14 @@ impl CIVisibilityTestsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_cloud_authentication.rs b/src/datadogV2/api/api_cloud_authentication.rs index 0fb9b733f6..d9ebdf6338 100644 --- a/src/datadogV2/api/api_cloud_authentication.rs +++ b/src/datadogV2/api/api_cloud_authentication.rs @@ -184,20 +184,14 @@ impl CloudAuthenticationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -337,20 +331,14 @@ impl CloudAuthenticationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -450,20 +438,14 @@ impl CloudAuthenticationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -568,20 +550,14 @@ impl CloudAuthenticationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_cloud_cost_management.rs b/src/datadogV2/api/api_cloud_cost_management.rs index 3b55d5ee0c..53e7e42c8d 100644 --- a/src/datadogV2/api/api_cloud_cost_management.rs +++ b/src/datadogV2/api/api_cloud_cost_management.rs @@ -476,20 +476,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -630,20 +624,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -787,20 +775,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -968,20 +950,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1120,20 +1096,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1258,20 +1228,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1348,20 +1312,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1439,20 +1397,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1531,20 +1483,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1622,20 +1568,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1710,20 +1650,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1801,20 +1735,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1900,20 +1828,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2010,20 +1932,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2120,20 +2036,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2230,20 +2140,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2342,20 +2246,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2451,20 +2349,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2561,20 +2453,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2662,20 +2548,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2765,20 +2645,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2871,20 +2745,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2977,20 +2845,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3083,20 +2945,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3214,20 +3070,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3320,20 +3170,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3430,20 +3274,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -3567,20 +3405,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -3720,20 +3552,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -3880,20 +3706,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -4040,20 +3860,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -4226,20 +4040,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -4384,20 +4192,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -4536,20 +4338,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -4687,20 +4483,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -4839,20 +4629,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -5081,20 +4865,14 @@ impl CloudCostManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_cloud_network_monitoring.rs b/src/datadogV2/api/api_cloud_network_monitoring.rs index f41109d82d..f27746be74 100644 --- a/src/datadogV2/api/api_cloud_network_monitoring.rs +++ b/src/datadogV2/api/api_cloud_network_monitoring.rs @@ -260,20 +260,14 @@ impl CloudNetworkMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -396,20 +390,14 @@ impl CloudNetworkMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_cloudflare_integration.rs b/src/datadogV2/api/api_cloudflare_integration.rs index d104e412ea..16330a9d1a 100644 --- a/src/datadogV2/api/api_cloudflare_integration.rs +++ b/src/datadogV2/api/api_cloudflare_integration.rs @@ -175,20 +175,14 @@ impl CloudflareIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -318,20 +312,14 @@ impl CloudflareIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -420,20 +408,14 @@ impl CloudflareIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -526,20 +508,14 @@ impl CloudflareIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -641,20 +617,14 @@ impl CloudflareIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_code_coverage.rs b/src/datadogV2/api/api_code_coverage.rs index 89f2d6e7d4..2b9d2909e2 100644 --- a/src/datadogV2/api/api_code_coverage.rs +++ b/src/datadogV2/api/api_code_coverage.rs @@ -167,20 +167,14 @@ impl CodeCoverageAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -340,20 +334,14 @@ impl CodeCoverageAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_confluent_cloud.rs b/src/datadogV2/api/api_confluent_cloud.rs index c2964bd5ec..53aa4cf53a 100644 --- a/src/datadogV2/api/api_confluent_cloud.rs +++ b/src/datadogV2/api/api_confluent_cloud.rs @@ -215,20 +215,14 @@ impl ConfluentCloudAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -375,20 +369,14 @@ impl ConfluentCloudAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -518,20 +506,14 @@ impl ConfluentCloudAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -612,20 +594,14 @@ impl ConfluentCloudAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -714,20 +690,14 @@ impl ConfluentCloudAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -829,20 +799,14 @@ impl ConfluentCloudAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -935,20 +899,14 @@ impl ConfluentCloudAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1047,20 +1005,14 @@ impl ConfluentCloudAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1162,20 +1114,14 @@ impl ConfluentCloudAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1325,20 +1271,14 @@ impl ConfluentCloudAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_container_images.rs b/src/datadogV2/api/api_container_images.rs index 1558a98874..63ce0d4ee9 100644 --- a/src/datadogV2/api/api_container_images.rs +++ b/src/datadogV2/api/api_container_images.rs @@ -253,20 +253,14 @@ impl ContainerImagesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_containers.rs b/src/datadogV2/api/api_containers.rs index b0baa5b7d9..5097448490 100644 --- a/src/datadogV2/api/api_containers.rs +++ b/src/datadogV2/api/api_containers.rs @@ -246,20 +246,14 @@ impl ContainersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_csm_agents.rs b/src/datadogV2/api/api_csm_agents.rs index c4cb3a5cc9..c4302c87e6 100644 --- a/src/datadogV2/api/api_csm_agents.rs +++ b/src/datadogV2/api/api_csm_agents.rs @@ -243,20 +243,14 @@ impl CSMAgentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -376,20 +370,14 @@ impl CSMAgentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_csm_coverage_analysis.rs b/src/datadogV2/api/api_csm_coverage_analysis.rs index 249cd2129c..8433ee4e4f 100644 --- a/src/datadogV2/api/api_csm_coverage_analysis.rs +++ b/src/datadogV2/api/api_csm_coverage_analysis.rs @@ -161,20 +161,14 @@ impl CSMCoverageAnalysisAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -277,20 +271,14 @@ impl CSMCoverageAnalysisAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -391,20 +379,14 @@ impl CSMCoverageAnalysisAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_csm_threats.rs b/src/datadogV2/api/api_csm_threats.rs index 3bf0968bd7..3aa11aa414 100644 --- a/src/datadogV2/api/api_csm_threats.rs +++ b/src/datadogV2/api/api_csm_threats.rs @@ -344,20 +344,14 @@ impl CSMThreatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -506,20 +500,14 @@ impl CSMThreatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -668,20 +656,14 @@ impl CSMThreatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -817,20 +799,14 @@ impl CSMThreatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -922,20 +898,14 @@ impl CSMThreatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1020,20 +990,14 @@ impl CSMThreatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1122,20 +1086,14 @@ impl CSMThreatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1229,20 +1187,14 @@ impl CSMThreatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1338,20 +1290,14 @@ impl CSMThreatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1465,20 +1411,14 @@ impl CSMThreatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1582,20 +1522,14 @@ impl CSMThreatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1695,20 +1629,14 @@ impl CSMThreatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1821,20 +1749,14 @@ impl CSMThreatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1937,20 +1859,14 @@ impl CSMThreatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2059,20 +1975,14 @@ impl CSMThreatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -2236,20 +2146,14 @@ impl CSMThreatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -2403,20 +2307,14 @@ impl CSMThreatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_dashboard_lists.rs b/src/datadogV2/api/api_dashboard_lists.rs index aba46584ac..ed032a31af 100644 --- a/src/datadogV2/api/api_dashboard_lists.rs +++ b/src/datadogV2/api/api_dashboard_lists.rs @@ -175,20 +175,14 @@ impl DashboardListsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -335,20 +329,14 @@ impl DashboardListsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -492,20 +480,14 @@ impl DashboardListsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -607,20 +589,14 @@ impl DashboardListsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_data_deletion.rs b/src/datadogV2/api/api_data_deletion.rs index 24f52fa266..010f2b6556 100644 --- a/src/datadogV2/api/api_data_deletion.rs +++ b/src/datadogV2/api/api_data_deletion.rs @@ -212,20 +212,14 @@ impl DataDeletionAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -335,20 +329,14 @@ impl DataDeletionAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -524,20 +512,14 @@ impl DataDeletionAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_datasets.rs b/src/datadogV2/api/api_datasets.rs index 245ab18c71..fc60262914 100644 --- a/src/datadogV2/api/api_datasets.rs +++ b/src/datadogV2/api/api_datasets.rs @@ -184,20 +184,14 @@ impl DatasetsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -332,20 +326,14 @@ impl DatasetsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -437,20 +425,14 @@ impl DatasetsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -552,20 +534,14 @@ impl DatasetsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -669,20 +645,14 @@ impl DatasetsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_deployment_gates.rs b/src/datadogV2/api/api_deployment_gates.rs index 8504f15f3b..6985b35048 100644 --- a/src/datadogV2/api/api_deployment_gates.rs +++ b/src/datadogV2/api/api_deployment_gates.rs @@ -240,20 +240,14 @@ impl DeploymentGatesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -408,20 +402,14 @@ impl DeploymentGatesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -556,20 +544,14 @@ impl DeploymentGatesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -658,20 +640,14 @@ impl DeploymentGatesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -768,20 +744,14 @@ impl DeploymentGatesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -885,20 +855,14 @@ impl DeploymentGatesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1005,20 +969,14 @@ impl DeploymentGatesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1125,20 +1083,14 @@ impl DeploymentGatesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1296,20 +1248,14 @@ impl DeploymentGatesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_domain_allowlist.rs b/src/datadogV2/api/api_domain_allowlist.rs index 7f822d62ff..eb1b14ce21 100644 --- a/src/datadogV2/api/api_domain_allowlist.rs +++ b/src/datadogV2/api/api_domain_allowlist.rs @@ -150,20 +150,14 @@ impl DomainAllowlistAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -259,20 +253,14 @@ impl DomainAllowlistAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_dora_metrics.rs b/src/datadogV2/api/api_dora_metrics.rs index b4a9b934fd..8dd208df9d 100644 --- a/src/datadogV2/api/api_dora_metrics.rs +++ b/src/datadogV2/api/api_dora_metrics.rs @@ -239,13 +239,14 @@ impl DORAMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -388,13 +389,14 @@ impl DORAMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -539,13 +541,14 @@ impl DORAMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -675,20 +678,14 @@ impl DORAMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -763,20 +760,14 @@ impl DORAMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -865,20 +856,14 @@ impl DORAMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -974,20 +959,14 @@ impl DORAMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1083,20 +1062,14 @@ impl DORAMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1237,20 +1210,14 @@ impl DORAMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1383,20 +1350,14 @@ impl DORAMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_downtimes.rs b/src/datadogV2/api/api_downtimes.rs index 666ac72a1d..0f7cf6bee0 100644 --- a/src/datadogV2/api/api_downtimes.rs +++ b/src/datadogV2/api/api_downtimes.rs @@ -260,20 +260,14 @@ impl DowntimesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -360,20 +354,14 @@ impl DowntimesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -520,20 +508,14 @@ impl DowntimesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -685,20 +667,14 @@ impl DowntimesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -851,20 +827,14 @@ impl DowntimesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -961,20 +931,14 @@ impl DowntimesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_entity_risk_scores.rs b/src/datadogV2/api/api_entity_risk_scores.rs index 97a6bc7d8c..9fbda0b480 100644 --- a/src/datadogV2/api/api_entity_risk_scores.rs +++ b/src/datadogV2/api/api_entity_risk_scores.rs @@ -259,20 +259,14 @@ impl EntityRiskScoresAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_error_tracking.rs b/src/datadogV2/api/api_error_tracking.rs index 7ea61eede9..d5d992eaf9 100644 --- a/src/datadogV2/api/api_error_tracking.rs +++ b/src/datadogV2/api/api_error_tracking.rs @@ -199,20 +199,14 @@ impl ErrorTrackingAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -315,20 +309,14 @@ impl ErrorTrackingAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -436,20 +424,14 @@ impl ErrorTrackingAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -593,20 +575,14 @@ impl ErrorTrackingAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -745,20 +721,14 @@ impl ErrorTrackingAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_events.rs b/src/datadogV2/api/api_events.rs index 62cf2f36b2..7759da2931 100644 --- a/src/datadogV2/api/api_events.rs +++ b/src/datadogV2/api/api_events.rs @@ -251,20 +251,14 @@ impl EventsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -401,20 +395,14 @@ impl EventsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -577,20 +565,14 @@ impl EventsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -733,20 +715,14 @@ impl EventsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_fastly_integration.rs b/src/datadogV2/api/api_fastly_integration.rs index 0d93bcc9d4..fc7a477344 100644 --- a/src/datadogV2/api/api_fastly_integration.rs +++ b/src/datadogV2/api/api_fastly_integration.rs @@ -215,20 +215,14 @@ impl FastlyIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -375,20 +369,14 @@ impl FastlyIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -515,20 +503,14 @@ impl FastlyIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -609,20 +591,14 @@ impl FastlyIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -709,20 +685,14 @@ impl FastlyIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -822,20 +792,14 @@ impl FastlyIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -928,20 +892,14 @@ impl FastlyIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1037,20 +995,14 @@ impl FastlyIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1152,20 +1104,14 @@ impl FastlyIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1315,20 +1261,14 @@ impl FastlyIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_fleet_automation.rs b/src/datadogV2/api/api_fleet_automation.rs index 196d5135b5..dd0cc19bca 100644 --- a/src/datadogV2/api/api_fleet_automation.rs +++ b/src/datadogV2/api/api_fleet_automation.rs @@ -367,20 +367,14 @@ impl FleetAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -500,20 +494,14 @@ impl FleetAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -683,20 +671,14 @@ impl FleetAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -863,20 +845,14 @@ impl FleetAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1027,20 +1003,14 @@ impl FleetAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1147,20 +1117,14 @@ impl FleetAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1320,20 +1284,14 @@ impl FleetAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1449,20 +1407,14 @@ impl FleetAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1571,20 +1523,14 @@ impl FleetAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1722,20 +1668,14 @@ impl FleetAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1853,20 +1793,14 @@ impl FleetAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1975,20 +1909,14 @@ impl FleetAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2122,20 +2050,14 @@ impl FleetAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2262,20 +2184,14 @@ impl FleetAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_gcp_integration.rs b/src/datadogV2/api/api_gcp_integration.rs index dc486c3b96..74d9a6297e 100644 --- a/src/datadogV2/api/api_gcp_integration.rs +++ b/src/datadogV2/api/api_gcp_integration.rs @@ -200,20 +200,14 @@ impl GCPIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -340,20 +334,14 @@ impl GCPIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -439,20 +427,14 @@ impl GCPIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -545,20 +527,14 @@ impl GCPIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -657,20 +633,14 @@ impl GCPIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -817,20 +787,14 @@ impl GCPIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_google_chat_integration.rs b/src/datadogV2/api/api_google_chat_integration.rs index 30574131d5..47d2781ac7 100644 --- a/src/datadogV2/api/api_google_chat_integration.rs +++ b/src/datadogV2/api/api_google_chat_integration.rs @@ -190,20 +190,14 @@ impl GoogleChatIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -338,20 +332,14 @@ impl GoogleChatIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -447,20 +435,14 @@ impl GoogleChatIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -564,20 +546,14 @@ impl GoogleChatIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -676,20 +652,14 @@ impl GoogleChatIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -796,20 +766,14 @@ impl GoogleChatIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_high_availability_multi_region.rs b/src/datadogV2/api/api_high_availability_multi_region.rs index b768421a1b..3f9f3ff2a4 100644 --- a/src/datadogV2/api/api_high_availability_multi_region.rs +++ b/src/datadogV2/api/api_high_availability_multi_region.rs @@ -168,20 +168,14 @@ impl HighAvailabilityMultiRegionAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -331,20 +325,14 @@ impl HighAvailabilityMultiRegionAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_incident_services.rs b/src/datadogV2/api/api_incident_services.rs index 1d7018b782..af1fc85691 100644 --- a/src/datadogV2/api/api_incident_services.rs +++ b/src/datadogV2/api/api_incident_services.rs @@ -237,20 +237,14 @@ impl IncidentServicesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -388,20 +382,14 @@ impl IncidentServicesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -513,20 +501,14 @@ impl IncidentServicesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -652,20 +634,14 @@ impl IncidentServicesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -775,20 +751,14 @@ impl IncidentServicesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_incident_teams.rs b/src/datadogV2/api/api_incident_teams.rs index 99e2b1ba4a..a2d2a43259 100644 --- a/src/datadogV2/api/api_incident_teams.rs +++ b/src/datadogV2/api/api_incident_teams.rs @@ -237,20 +237,14 @@ impl IncidentTeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -385,20 +379,14 @@ impl IncidentTeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -505,20 +493,14 @@ impl IncidentTeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -644,20 +626,14 @@ impl IncidentTeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -767,20 +743,14 @@ impl IncidentTeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_incidents.rs b/src/datadogV2/api/api_incidents.rs index 170c4f9353..c7600997ad 100644 --- a/src/datadogV2/api/api_incidents.rs +++ b/src/datadogV2/api/api_incidents.rs @@ -989,20 +989,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1149,20 +1143,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1324,20 +1312,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1499,20 +1481,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1667,20 +1643,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1832,20 +1802,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1998,20 +1962,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -2175,20 +2133,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -2339,20 +2291,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -2507,20 +2453,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -2669,20 +2609,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -2814,20 +2748,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2910,20 +2838,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3010,20 +2932,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3104,20 +3020,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3207,20 +3117,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3317,20 +3221,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3428,20 +3326,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3529,20 +3421,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3631,20 +3517,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3730,20 +3610,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3837,20 +3711,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3968,20 +3836,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4090,20 +3952,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4220,20 +4076,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4350,20 +4200,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4470,20 +4314,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4591,20 +4429,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4709,20 +4541,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4845,20 +4671,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -5017,20 +4837,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -5152,20 +4966,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -5279,20 +5087,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -5399,20 +5201,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -5527,20 +5323,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -5660,20 +5450,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -5777,20 +5561,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -5894,20 +5672,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -6018,20 +5790,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -6194,20 +5960,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -6372,20 +6132,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -6502,20 +6256,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -6667,20 +6415,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -6850,20 +6592,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -7026,20 +6762,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -7196,20 +6926,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -7374,20 +7098,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -7553,20 +7271,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -7722,20 +7434,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -7893,20 +7599,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -8061,20 +7761,14 @@ impl IncidentsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_integrations.rs b/src/datadogV2/api/api_integrations.rs index 7f50a265e7..599797f41b 100644 --- a/src/datadogV2/api/api_integrations.rs +++ b/src/datadogV2/api/api_integrations.rs @@ -134,20 +134,14 @@ impl IntegrationsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_ip_allowlist.rs b/src/datadogV2/api/api_ip_allowlist.rs index 8ea8739df0..5b3ddc792b 100644 --- a/src/datadogV2/api/api_ip_allowlist.rs +++ b/src/datadogV2/api/api_ip_allowlist.rs @@ -151,20 +151,14 @@ impl IPAllowlistAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -258,20 +252,14 @@ impl IPAllowlistAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_jira_integration.rs b/src/datadogV2/api/api_jira_integration.rs index d3ecad6f73..21bc433a97 100644 --- a/src/datadogV2/api/api_jira_integration.rs +++ b/src/datadogV2/api/api_jira_integration.rs @@ -205,20 +205,14 @@ impl JiraIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -353,20 +347,14 @@ impl JiraIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -452,20 +440,14 @@ impl JiraIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -565,20 +547,14 @@ impl JiraIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -677,20 +653,14 @@ impl JiraIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -791,20 +761,14 @@ impl JiraIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -914,20 +878,14 @@ impl JiraIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_key_management.rs b/src/datadogV2/api/api_key_management.rs index 49aeec38ce..3174467300 100644 --- a/src/datadogV2/api/api_key_management.rs +++ b/src/datadogV2/api/api_key_management.rs @@ -496,20 +496,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -650,20 +644,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -790,20 +778,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -877,20 +859,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -969,20 +945,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1078,20 +1048,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1197,20 +1161,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1311,20 +1269,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1476,20 +1428,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1619,20 +1565,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1768,20 +1708,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1877,20 +1811,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -2034,20 +1962,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -2196,20 +2118,14 @@ impl KeyManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_logs.rs b/src/datadogV2/api/api_logs.rs index 24b82be0f1..902b420d9e 100644 --- a/src/datadogV2/api/api_logs.rs +++ b/src/datadogV2/api/api_logs.rs @@ -271,20 +271,14 @@ impl LogsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -485,20 +479,14 @@ impl LogsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -741,20 +729,14 @@ impl LogsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -913,13 +895,14 @@ impl LogsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_logs_archives.rs b/src/datadogV2/api/api_logs_archives.rs index 2f841fbccc..87907b3d13 100644 --- a/src/datadogV2/api/api_logs_archives.rs +++ b/src/datadogV2/api/api_logs_archives.rs @@ -210,20 +210,14 @@ impl LogsArchivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -354,20 +348,14 @@ impl LogsArchivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -492,20 +480,14 @@ impl LogsArchivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -591,20 +573,14 @@ impl LogsArchivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -695,20 +671,14 @@ impl LogsArchivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -804,20 +774,14 @@ impl LogsArchivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -905,20 +869,14 @@ impl LogsArchivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1004,20 +962,14 @@ impl LogsArchivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1160,20 +1112,14 @@ impl LogsArchivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1320,20 +1266,14 @@ impl LogsArchivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_logs_custom_destinations.rs b/src/datadogV2/api/api_logs_custom_destinations.rs index 5951887e1e..79955dd4ba 100644 --- a/src/datadogV2/api/api_logs_custom_destinations.rs +++ b/src/datadogV2/api/api_logs_custom_destinations.rs @@ -183,20 +183,14 @@ impl LogsCustomDestinationsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -327,20 +321,14 @@ impl LogsCustomDestinationsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -432,20 +420,14 @@ impl LogsCustomDestinationsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -538,20 +520,14 @@ impl LogsCustomDestinationsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -653,20 +629,14 @@ impl LogsCustomDestinationsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_logs_metrics.rs b/src/datadogV2/api/api_logs_metrics.rs index efbc60591b..0026148249 100644 --- a/src/datadogV2/api/api_logs_metrics.rs +++ b/src/datadogV2/api/api_logs_metrics.rs @@ -175,20 +175,14 @@ impl LogsMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -315,20 +309,14 @@ impl LogsMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -415,20 +403,14 @@ impl LogsMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -519,20 +501,14 @@ impl LogsMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -634,20 +610,14 @@ impl LogsMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_logs_restriction_queries.rs b/src/datadogV2/api/api_logs_restriction_queries.rs index 6e986a658e..4d20d63beb 100644 --- a/src/datadogV2/api/api_logs_restriction_queries.rs +++ b/src/datadogV2/api/api_logs_restriction_queries.rs @@ -289,20 +289,14 @@ impl LogsRestrictionQueriesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -446,20 +440,14 @@ impl LogsRestrictionQueriesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -598,20 +586,14 @@ impl LogsRestrictionQueriesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -713,20 +695,14 @@ impl LogsRestrictionQueriesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -834,20 +810,14 @@ impl LogsRestrictionQueriesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -963,20 +933,14 @@ impl LogsRestrictionQueriesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1098,20 +1062,14 @@ impl LogsRestrictionQueriesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1218,20 +1176,14 @@ impl LogsRestrictionQueriesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1328,20 +1280,14 @@ impl LogsRestrictionQueriesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1491,20 +1437,14 @@ impl LogsRestrictionQueriesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1662,20 +1602,14 @@ impl LogsRestrictionQueriesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_metrics.rs b/src/datadogV2/api/api_metrics.rs index 30259ad1b6..cee8b0fe3f 100644 --- a/src/datadogV2/api/api_metrics.rs +++ b/src/datadogV2/api/api_metrics.rs @@ -546,20 +546,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -714,20 +708,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -877,20 +865,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1022,20 +1004,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1157,20 +1133,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1269,20 +1239,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1393,20 +1357,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1501,20 +1459,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1613,20 +1565,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1829,20 +1775,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1979,20 +1919,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2095,20 +2029,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2208,20 +2136,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -2364,20 +2286,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -2553,13 +2469,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -2714,20 +2631,14 @@ impl MetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_microsoft_teams_integration.rs b/src/datadogV2/api/api_microsoft_teams_integration.rs index 0012f79404..78c06d5011 100644 --- a/src/datadogV2/api/api_microsoft_teams_integration.rs +++ b/src/datadogV2/api/api_microsoft_teams_integration.rs @@ -263,20 +263,14 @@ impl MicrosoftTeamsIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -423,20 +417,14 @@ impl MicrosoftTeamsIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -567,20 +555,14 @@ impl MicrosoftTeamsIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -659,20 +641,14 @@ impl MicrosoftTeamsIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -772,20 +748,14 @@ impl MicrosoftTeamsIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -882,20 +852,14 @@ impl MicrosoftTeamsIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -997,20 +961,14 @@ impl MicrosoftTeamsIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1119,20 +1077,14 @@ impl MicrosoftTeamsIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1241,20 +1193,14 @@ impl MicrosoftTeamsIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1357,20 +1303,14 @@ impl MicrosoftTeamsIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1520,20 +1460,14 @@ impl MicrosoftTeamsIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_monitors.rs b/src/datadogV2/api/api_monitors.rs index a501dea828..e8df9715ba 100644 --- a/src/datadogV2/api/api_monitors.rs +++ b/src/datadogV2/api/api_monitors.rs @@ -362,20 +362,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -519,20 +513,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -681,20 +669,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -824,20 +806,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -916,20 +892,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1015,20 +985,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1120,20 +1084,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1242,20 +1200,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1381,20 +1333,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1511,20 +1457,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1617,20 +1557,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1731,20 +1665,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1846,20 +1774,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -2006,20 +1928,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -2174,20 +2090,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -2332,20 +2242,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -2477,20 +2381,14 @@ impl MonitorsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_network_device_monitoring.rs b/src/datadogV2/api/api_network_device_monitoring.rs index e56fa1714a..1a4a46465a 100644 --- a/src/datadogV2/api/api_network_device_monitoring.rs +++ b/src/datadogV2/api/api_network_device_monitoring.rs @@ -243,20 +243,14 @@ impl NetworkDeviceMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -358,20 +352,14 @@ impl NetworkDeviceMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -465,20 +453,14 @@ impl NetworkDeviceMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -627,20 +609,14 @@ impl NetworkDeviceMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -738,20 +714,14 @@ impl NetworkDeviceMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -851,20 +821,14 @@ impl NetworkDeviceMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1010,20 +974,14 @@ impl NetworkDeviceMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_observability_pipelines.rs b/src/datadogV2/api/api_observability_pipelines.rs index f9d1735cb4..945d98dfea 100644 --- a/src/datadogV2/api/api_observability_pipelines.rs +++ b/src/datadogV2/api/api_observability_pipelines.rs @@ -204,20 +204,14 @@ impl ObservabilityPipelinesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -344,20 +338,14 @@ impl ObservabilityPipelinesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -444,20 +432,14 @@ impl ObservabilityPipelinesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -562,20 +544,14 @@ impl ObservabilityPipelinesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -672,20 +648,14 @@ impl ObservabilityPipelinesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -826,20 +796,14 @@ impl ObservabilityPipelinesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_oci_integration.rs b/src/datadogV2/api/api_oci_integration.rs index 1f30ea174a..bdb3575aba 100644 --- a/src/datadogV2/api/api_oci_integration.rs +++ b/src/datadogV2/api/api_oci_integration.rs @@ -190,20 +190,14 @@ impl OCIIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -331,20 +325,14 @@ impl OCIIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -430,20 +418,14 @@ impl OCIIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -540,20 +522,14 @@ impl OCIIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -652,20 +628,14 @@ impl OCIIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -765,20 +735,14 @@ impl OCIIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_okta_integration.rs b/src/datadogV2/api/api_okta_integration.rs index 2a65b52bdb..214272f325 100644 --- a/src/datadogV2/api/api_okta_integration.rs +++ b/src/datadogV2/api/api_okta_integration.rs @@ -173,20 +173,14 @@ impl OktaIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -313,20 +307,14 @@ impl OktaIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -413,20 +401,14 @@ impl OktaIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -517,20 +499,14 @@ impl OktaIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -630,20 +606,14 @@ impl OktaIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_on_call.rs b/src/datadogV2/api/api_on_call.rs index a747088722..93aeceb598 100644 --- a/src/datadogV2/api/api_on_call.rs +++ b/src/datadogV2/api/api_on_call.rs @@ -532,20 +532,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -695,20 +689,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -853,20 +841,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1013,20 +995,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1157,20 +1133,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1248,20 +1218,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1343,20 +1307,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1437,20 +1395,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1552,20 +1504,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1670,20 +1616,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1790,20 +1730,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1913,20 +1847,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2033,20 +1961,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2148,20 +2070,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2273,20 +2189,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2385,20 +2295,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2507,20 +2411,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2632,20 +2530,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -2801,20 +2693,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -2967,20 +2853,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -3138,20 +3018,14 @@ impl OnCallAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_on_call_paging.rs b/src/datadogV2/api/api_on_call_paging.rs index e4704dcc60..e6a60842fb 100644 --- a/src/datadogV2/api/api_on_call_paging.rs +++ b/src/datadogV2/api/api_on_call_paging.rs @@ -154,20 +154,14 @@ impl OnCallPagingAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -254,20 +248,14 @@ impl OnCallPagingAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -394,20 +382,14 @@ impl OnCallPagingAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -482,20 +464,14 @@ impl OnCallPagingAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_opsgenie_integration.rs b/src/datadogV2/api/api_opsgenie_integration.rs index c0c9d80e7c..9433f2e1ee 100644 --- a/src/datadogV2/api/api_opsgenie_integration.rs +++ b/src/datadogV2/api/api_opsgenie_integration.rs @@ -176,20 +176,14 @@ impl OpsgenieIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -319,20 +313,14 @@ impl OpsgenieIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -424,20 +412,14 @@ impl OpsgenieIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -530,20 +512,14 @@ impl OpsgenieIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -645,20 +621,14 @@ impl OpsgenieIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_org_connections.rs b/src/datadogV2/api/api_org_connections.rs index d8a657fc33..26ec41cb64 100644 --- a/src/datadogV2/api/api_org_connections.rs +++ b/src/datadogV2/api/api_org_connections.rs @@ -204,20 +204,14 @@ impl OrgConnectionsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -347,20 +341,14 @@ impl OrgConnectionsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -471,20 +459,14 @@ impl OrgConnectionsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -586,20 +568,14 @@ impl OrgConnectionsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_organizations.rs b/src/datadogV2/api/api_organizations.rs index 0037ecd42a..62200e1430 100644 --- a/src/datadogV2/api/api_organizations.rs +++ b/src/datadogV2/api/api_organizations.rs @@ -181,20 +181,14 @@ impl OrganizationsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -284,20 +278,14 @@ impl OrganizationsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -397,20 +385,14 @@ impl OrganizationsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -547,20 +529,14 @@ impl OrganizationsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build form parameters if let Some(idp_file) = idp_file { diff --git a/src/datadogV2/api/api_powerpack.rs b/src/datadogV2/api/api_powerpack.rs index bb739ef41a..2809644036 100644 --- a/src/datadogV2/api/api_powerpack.rs +++ b/src/datadogV2/api/api_powerpack.rs @@ -208,20 +208,14 @@ impl PowerpackAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -347,20 +341,14 @@ impl PowerpackAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -446,20 +434,14 @@ impl PowerpackAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -598,20 +580,14 @@ impl PowerpackAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -711,20 +687,14 @@ impl PowerpackAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_processes.rs b/src/datadogV2/api/api_processes.rs index a334f4e819..8978bb7b54 100644 --- a/src/datadogV2/api/api_processes.rs +++ b/src/datadogV2/api/api_processes.rs @@ -265,20 +265,14 @@ impl ProcessesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_product_analytics.rs b/src/datadogV2/api/api_product_analytics.rs index 64b5c8e993..137064dd5e 100644 --- a/src/datadogV2/api/api_product_analytics.rs +++ b/src/datadogV2/api/api_product_analytics.rs @@ -169,20 +169,14 @@ impl ProductAnalyticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -330,20 +324,14 @@ impl ProductAnalyticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -543,13 +531,14 @@ impl ProductAnalyticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_reference_tables.rs b/src/datadogV2/api/api_reference_tables.rs index f69e837a0e..1a531daae8 100644 --- a/src/datadogV2/api/api_reference_tables.rs +++ b/src/datadogV2/api/api_reference_tables.rs @@ -264,20 +264,14 @@ impl ReferenceTablesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -419,20 +413,14 @@ impl ReferenceTablesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -562,20 +550,14 @@ impl ReferenceTablesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -691,20 +673,14 @@ impl ReferenceTablesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -802,20 +778,14 @@ impl ReferenceTablesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -907,20 +877,14 @@ impl ReferenceTablesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1044,20 +1008,14 @@ impl ReferenceTablesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1141,20 +1099,14 @@ impl ReferenceTablesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1277,20 +1229,14 @@ impl ReferenceTablesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_restriction_policies.rs b/src/datadogV2/api/api_restriction_policies.rs index 4018649d1c..7236b03e51 100644 --- a/src/datadogV2/api/api_restriction_policies.rs +++ b/src/datadogV2/api/api_restriction_policies.rs @@ -166,20 +166,14 @@ impl RestrictionPoliciesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -271,20 +265,14 @@ impl RestrictionPoliciesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -506,20 +494,14 @@ impl RestrictionPoliciesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_roles.rs b/src/datadogV2/api/api_roles.rs index d90f532b7a..08a0dfa1bb 100644 --- a/src/datadogV2/api/api_roles.rs +++ b/src/datadogV2/api/api_roles.rs @@ -353,20 +353,14 @@ impl RolesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -507,20 +501,14 @@ impl RolesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -659,20 +647,14 @@ impl RolesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -807,20 +789,14 @@ impl RolesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -946,20 +922,14 @@ impl RolesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1044,20 +1014,14 @@ impl RolesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1145,20 +1109,14 @@ impl RolesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1254,20 +1212,14 @@ impl RolesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1366,20 +1318,14 @@ impl RolesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1496,20 +1442,14 @@ impl RolesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1627,20 +1567,14 @@ impl RolesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1739,20 +1673,14 @@ impl RolesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1897,20 +1825,14 @@ impl RolesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -2049,20 +1971,14 @@ impl RolesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_rum.rs b/src/datadogV2/api/api_rum.rs index f69f734f03..daa8ff8caf 100644 --- a/src/datadogV2/api/api_rum.rs +++ b/src/datadogV2/api/api_rum.rs @@ -252,20 +252,14 @@ impl RUMAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -406,20 +400,14 @@ impl RUMAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -546,20 +534,14 @@ impl RUMAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -648,20 +630,14 @@ impl RUMAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -754,20 +730,14 @@ impl RUMAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -942,20 +912,14 @@ impl RUMAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1096,20 +1060,14 @@ impl RUMAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1252,20 +1210,14 @@ impl RUMAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_rum_audience_management.rs b/src/datadogV2/api/api_rum_audience_management.rs index 6af72da5d3..81877491d6 100644 --- a/src/datadogV2/api/api_rum_audience_management.rs +++ b/src/datadogV2/api/api_rum_audience_management.rs @@ -213,20 +213,14 @@ impl RumAudienceManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -357,20 +351,14 @@ impl RumAudienceManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -465,20 +453,14 @@ impl RumAudienceManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -623,20 +605,14 @@ impl RumAudienceManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -737,20 +713,14 @@ impl RumAudienceManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -898,20 +868,14 @@ impl RumAudienceManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1012,20 +976,14 @@ impl RumAudienceManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1170,20 +1128,14 @@ impl RumAudienceManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1327,20 +1279,14 @@ impl RumAudienceManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1475,20 +1421,14 @@ impl RumAudienceManagementAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_rum_metrics.rs b/src/datadogV2/api/api_rum_metrics.rs index 269995bfed..176bc6b094 100644 --- a/src/datadogV2/api/api_rum_metrics.rs +++ b/src/datadogV2/api/api_rum_metrics.rs @@ -175,20 +175,14 @@ impl RumMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -314,20 +308,14 @@ impl RumMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -413,20 +401,14 @@ impl RumMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -515,20 +497,14 @@ impl RumMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -627,20 +603,14 @@ impl RumMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_rum_replay_heatmaps.rs b/src/datadogV2/api/api_rum_replay_heatmaps.rs index 7f3f11d823..2ea9bf23ed 100644 --- a/src/datadogV2/api/api_rum_replay_heatmaps.rs +++ b/src/datadogV2/api/api_rum_replay_heatmaps.rs @@ -198,20 +198,14 @@ impl RumReplayHeatmapsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -340,20 +334,14 @@ impl RumReplayHeatmapsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -466,20 +454,14 @@ impl RumReplayHeatmapsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -577,20 +559,14 @@ impl RumReplayHeatmapsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_rum_replay_playlists.rs b/src/datadogV2/api/api_rum_replay_playlists.rs index b4bd0b8f5f..0d5017288d 100644 --- a/src/datadogV2/api/api_rum_replay_playlists.rs +++ b/src/datadogV2/api/api_rum_replay_playlists.rs @@ -302,20 +302,14 @@ impl RumReplayPlaylistsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -405,20 +399,14 @@ impl RumReplayPlaylistsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -550,20 +538,14 @@ impl RumReplayPlaylistsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -691,20 +673,14 @@ impl RumReplayPlaylistsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -793,20 +769,14 @@ impl RumReplayPlaylistsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -918,20 +888,14 @@ impl RumReplayPlaylistsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1047,20 +1011,14 @@ impl RumReplayPlaylistsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1147,20 +1105,14 @@ impl RumReplayPlaylistsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1253,20 +1205,14 @@ impl RumReplayPlaylistsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_rum_replay_sessions.rs b/src/datadogV2/api/api_rum_replay_sessions.rs index 6601b6a8bc..8154672235 100644 --- a/src/datadogV2/api/api_rum_replay_sessions.rs +++ b/src/datadogV2/api/api_rum_replay_sessions.rs @@ -191,20 +191,14 @@ impl RumReplaySessionsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_rum_replay_viewership.rs b/src/datadogV2/api/api_rum_replay_viewership.rs index 9abb945b85..58bc0e242d 100644 --- a/src/datadogV2/api/api_rum_replay_viewership.rs +++ b/src/datadogV2/api/api_rum_replay_viewership.rs @@ -252,20 +252,14 @@ impl RumReplayViewershipAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -394,20 +388,14 @@ impl RumReplayViewershipAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -514,20 +502,14 @@ impl RumReplayViewershipAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -661,20 +643,14 @@ impl RumReplayViewershipAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_rum_retention_filters.rs b/src/datadogV2/api/api_rum_retention_filters.rs index e9181d438b..c580045b2d 100644 --- a/src/datadogV2/api/api_rum_retention_filters.rs +++ b/src/datadogV2/api/api_rum_retention_filters.rs @@ -191,20 +191,14 @@ impl RumRetentionFiltersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -337,20 +331,14 @@ impl RumRetentionFiltersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -445,20 +433,14 @@ impl RumRetentionFiltersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -554,20 +536,14 @@ impl RumRetentionFiltersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -671,20 +647,14 @@ impl RumRetentionFiltersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -836,20 +806,14 @@ impl RumRetentionFiltersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_seats.rs b/src/datadogV2/api/api_seats.rs index 07977df077..64649f3798 100644 --- a/src/datadogV2/api/api_seats.rs +++ b/src/datadogV2/api/api_seats.rs @@ -182,20 +182,14 @@ impl SeatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -352,20 +346,14 @@ impl SeatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -446,20 +434,14 @@ impl SeatsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_security_monitoring.rs b/src/datadogV2/api/api_security_monitoring.rs index 6e3384a1e9..c4d359a480 100644 --- a/src/datadogV2/api/api_security_monitoring.rs +++ b/src/datadogV2/api/api_security_monitoring.rs @@ -1976,20 +1976,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2080,20 +2074,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -2233,20 +2221,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -2391,20 +2373,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -2532,20 +2508,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2649,20 +2619,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2753,20 +2717,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -2915,20 +2873,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -3070,20 +3022,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -3223,20 +3169,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -3379,20 +3319,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -3539,20 +3473,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -3696,20 +3624,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -3854,20 +3776,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -4011,20 +3927,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -4169,20 +4079,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -4326,20 +4230,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -4479,20 +4377,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4587,20 +4479,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4685,20 +4571,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4779,20 +4659,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4871,20 +4745,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4965,20 +4833,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -5057,20 +4919,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -5153,20 +5009,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -5247,20 +5097,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -5337,20 +5181,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -5491,20 +5329,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -5654,20 +5486,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -5817,20 +5643,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -5983,20 +5803,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -6096,20 +5910,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -6212,20 +6020,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -6336,20 +6138,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -6464,20 +6260,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -6600,20 +6390,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -6728,20 +6512,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -6837,20 +6615,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -6953,20 +6725,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -7065,20 +6831,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -7186,20 +6946,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -7346,20 +7100,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -7459,20 +7207,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -7571,20 +7313,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -7683,20 +7419,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -7793,20 +7523,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -7899,20 +7623,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -8026,20 +7744,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -8139,20 +7851,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -8297,20 +8003,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -8415,20 +8115,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -8527,20 +8221,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -8636,20 +8324,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -8811,20 +8493,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -9128,20 +8804,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -9244,20 +8914,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -9529,20 +9193,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -9635,20 +9293,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -9816,20 +9468,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -9935,20 +9581,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -10093,20 +9733,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -10228,20 +9862,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -10418,20 +10046,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -10555,20 +10177,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -10695,20 +10311,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -11250,20 +10860,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -11491,20 +11095,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -11606,20 +11204,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -11765,20 +11357,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -11925,20 +11511,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -12085,20 +11665,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -12297,20 +11871,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -12466,20 +12034,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -12675,20 +12237,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -12836,20 +12392,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -12993,20 +12543,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -13156,20 +12700,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -13313,20 +12851,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -13476,20 +13008,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -13636,20 +13162,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -13803,20 +13323,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -13963,20 +13477,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -14108,20 +13616,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -14247,20 +13749,14 @@ impl SecurityMonitoringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_sensitive_data_scanner.rs b/src/datadogV2/api/api_sensitive_data_scanner.rs index d5e275e53b..9c28d2c026 100644 --- a/src/datadogV2/api/api_sensitive_data_scanner.rs +++ b/src/datadogV2/api/api_sensitive_data_scanner.rs @@ -215,20 +215,14 @@ impl SensitiveDataScannerAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -378,20 +372,14 @@ impl SensitiveDataScannerAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -539,20 +527,14 @@ impl SensitiveDataScannerAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -700,20 +682,14 @@ impl SensitiveDataScannerAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -852,20 +828,14 @@ impl SensitiveDataScannerAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -961,20 +931,14 @@ impl SensitiveDataScannerAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1073,20 +1037,14 @@ impl SensitiveDataScannerAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1240,20 +1198,14 @@ impl SensitiveDataScannerAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1407,20 +1359,14 @@ impl SensitiveDataScannerAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_service_accounts.rs b/src/datadogV2/api/api_service_accounts.rs index 4018bdf718..756bbe1178 100644 --- a/src/datadogV2/api/api_service_accounts.rs +++ b/src/datadogV2/api/api_service_accounts.rs @@ -236,20 +236,14 @@ impl ServiceAccountsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -394,20 +388,14 @@ impl ServiceAccountsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -541,20 +529,14 @@ impl ServiceAccountsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -649,20 +631,14 @@ impl ServiceAccountsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -796,20 +772,14 @@ impl ServiceAccountsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -918,20 +888,14 @@ impl ServiceAccountsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_service_definition.rs b/src/datadogV2/api/api_service_definition.rs index 92daf222bf..b55135be84 100644 --- a/src/datadogV2/api/api_service_definition.rs +++ b/src/datadogV2/api/api_service_definition.rs @@ -225,20 +225,14 @@ impl ServiceDefinitionAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -368,20 +362,14 @@ impl ServiceDefinitionAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -483,20 +471,14 @@ impl ServiceDefinitionAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -646,20 +628,14 @@ impl ServiceDefinitionAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_service_level_objectives.rs b/src/datadogV2/api/api_service_level_objectives.rs index 10cf053a62..7e9ecce9f6 100644 --- a/src/datadogV2/api/api_service_level_objectives.rs +++ b/src/datadogV2/api/api_service_level_objectives.rs @@ -202,20 +202,14 @@ impl ServiceLevelObjectivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -362,20 +356,14 @@ impl ServiceLevelObjectivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -479,20 +467,14 @@ impl ServiceLevelObjectivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -616,20 +598,14 @@ impl ServiceLevelObjectivesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_service_now_integration.rs b/src/datadogV2/api/api_service_now_integration.rs index a0fbbedd38..722d6da2b7 100644 --- a/src/datadogV2/api/api_service_now_integration.rs +++ b/src/datadogV2/api/api_service_now_integration.rs @@ -224,20 +224,14 @@ impl ServiceNowIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -375,20 +369,14 @@ impl ServiceNowIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -488,20 +476,14 @@ impl ServiceNowIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -608,20 +590,14 @@ impl ServiceNowIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -728,20 +704,14 @@ impl ServiceNowIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -842,20 +812,14 @@ impl ServiceNowIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -956,20 +920,14 @@ impl ServiceNowIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1076,20 +1034,14 @@ impl ServiceNowIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1199,20 +1151,14 @@ impl ServiceNowIntegrationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_service_scorecards.rs b/src/datadogV2/api/api_service_scorecards.rs index aeeb1d6cb5..c51dc14dec 100644 --- a/src/datadogV2/api/api_service_scorecards.rs +++ b/src/datadogV2/api/api_service_scorecards.rs @@ -365,20 +365,14 @@ impl ServiceScorecardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -525,20 +519,14 @@ impl ServiceScorecardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -673,20 +661,14 @@ impl ServiceScorecardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -873,20 +855,14 @@ impl ServiceScorecardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1077,20 +1053,14 @@ impl ServiceScorecardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1183,20 +1153,14 @@ impl ServiceScorecardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1342,20 +1306,14 @@ impl ServiceScorecardsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_software_catalog.rs b/src/datadogV2/api/api_software_catalog.rs index 2794a449a9..086224e29c 100644 --- a/src/datadogV2/api/api_software_catalog.rs +++ b/src/datadogV2/api/api_software_catalog.rs @@ -368,20 +368,14 @@ impl SoftwareCatalogAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -456,20 +450,14 @@ impl SoftwareCatalogAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -650,20 +638,14 @@ impl SoftwareCatalogAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -816,20 +798,14 @@ impl SoftwareCatalogAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1000,20 +976,14 @@ impl SoftwareCatalogAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1104,20 +1074,14 @@ impl SoftwareCatalogAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1213,20 +1177,14 @@ impl SoftwareCatalogAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1367,20 +1325,14 @@ impl SoftwareCatalogAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_spans.rs b/src/datadogV2/api/api_spans.rs index 23d4ef13be..74c72ef62f 100644 --- a/src/datadogV2/api/api_spans.rs +++ b/src/datadogV2/api/api_spans.rs @@ -212,20 +212,14 @@ impl SpansAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -418,20 +412,14 @@ impl SpansAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -645,20 +633,14 @@ impl SpansAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_spans_metrics.rs b/src/datadogV2/api/api_spans_metrics.rs index 6f0939bb62..810e39b70d 100644 --- a/src/datadogV2/api/api_spans_metrics.rs +++ b/src/datadogV2/api/api_spans_metrics.rs @@ -175,20 +175,14 @@ impl SpansMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -315,20 +309,14 @@ impl SpansMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -415,20 +403,14 @@ impl SpansMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -519,20 +501,14 @@ impl SpansMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -634,20 +610,14 @@ impl SpansMetricsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_static_analysis.rs b/src/datadogV2/api/api_static_analysis.rs index d9d019c248..527cc328d7 100644 --- a/src/datadogV2/api/api_static_analysis.rs +++ b/src/datadogV2/api/api_static_analysis.rs @@ -278,20 +278,14 @@ impl StaticAnalysisAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -435,20 +429,14 @@ impl StaticAnalysisAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -592,20 +580,14 @@ impl StaticAnalysisAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -738,20 +720,14 @@ impl StaticAnalysisAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -885,20 +861,14 @@ impl StaticAnalysisAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -984,20 +954,14 @@ impl StaticAnalysisAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1098,20 +1062,14 @@ impl StaticAnalysisAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1226,20 +1184,14 @@ impl StaticAnalysisAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1341,20 +1293,14 @@ impl StaticAnalysisAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1519,20 +1465,14 @@ impl StaticAnalysisAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1632,20 +1572,14 @@ impl StaticAnalysisAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1793,20 +1727,14 @@ impl StaticAnalysisAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_status_pages.rs b/src/datadogV2/api/api_status_pages.rs index 4f388b3840..6dc0573f44 100644 --- a/src/datadogV2/api/api_status_pages.rs +++ b/src/datadogV2/api/api_status_pages.rs @@ -524,20 +524,14 @@ impl StatusPagesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -696,20 +690,14 @@ impl StatusPagesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -855,20 +843,14 @@ impl StatusPagesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -999,20 +981,14 @@ impl StatusPagesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1093,20 +1069,14 @@ impl StatusPagesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1181,20 +1151,14 @@ impl StatusPagesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1297,20 +1261,14 @@ impl StatusPagesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1418,20 +1376,14 @@ impl StatusPagesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1532,20 +1484,14 @@ impl StatusPagesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1649,20 +1595,14 @@ impl StatusPagesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1783,20 +1723,14 @@ impl StatusPagesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1906,20 +1840,14 @@ impl StatusPagesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2030,20 +1958,14 @@ impl StatusPagesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -2205,20 +2127,14 @@ impl StatusPagesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -2375,20 +2291,14 @@ impl StatusPagesAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_synthetics.rs b/src/datadogV2/api/api_synthetics.rs index 24d9dcd267..3fd9490be2 100644 --- a/src/datadogV2/api/api_synthetics.rs +++ b/src/datadogV2/api/api_synthetics.rs @@ -282,20 +282,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -434,20 +428,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -586,20 +574,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -738,20 +720,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -896,20 +872,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1047,20 +1017,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1157,20 +1121,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1264,20 +1222,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1393,20 +1345,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1574,20 +1520,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1685,20 +1625,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1843,20 +1777,14 @@ impl SyntheticsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_teams.rs b/src/datadogV2/api/api_teams.rs index 8eeb74020c..9ea8a0d521 100644 --- a/src/datadogV2/api/api_teams.rs +++ b/src/datadogV2/api/api_teams.rs @@ -629,20 +629,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -776,20 +770,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -929,20 +917,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1080,20 +1062,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1235,20 +1211,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -1396,20 +1366,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1553,20 +1517,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1693,20 +1651,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1780,20 +1732,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1916,20 +1862,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2014,20 +1954,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2106,20 +2040,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2205,20 +2133,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2311,20 +2233,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2420,20 +2336,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2524,20 +2434,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2692,20 +2596,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2804,20 +2702,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2914,20 +2806,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3026,20 +2912,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3136,20 +3016,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3241,20 +3115,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3425,20 +3293,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3629,20 +3491,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3797,20 +3653,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -3983,20 +3833,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4093,20 +3937,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4184,20 +4022,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -4292,20 +4124,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -4440,20 +4266,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -4598,20 +4418,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -4762,20 +4576,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -4922,20 +4730,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -5085,20 +4887,14 @@ impl TeamsAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_test_optimization.rs b/src/datadogV2/api/api_test_optimization.rs index 9c6cea751d..4cf7a39782 100644 --- a/src/datadogV2/api/api_test_optimization.rs +++ b/src/datadogV2/api/api_test_optimization.rs @@ -252,20 +252,14 @@ impl TestOptimizationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -414,20 +408,14 @@ impl TestOptimizationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_usage_metering.rs b/src/datadogV2/api/api_usage_metering.rs index 6689c31da6..6d5fec8cc9 100644 --- a/src/datadogV2/api/api_usage_metering.rs +++ b/src/datadogV2/api/api_usage_metering.rs @@ -539,20 +539,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -674,20 +668,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -813,20 +801,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -973,20 +955,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1118,20 +1094,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1289,20 +1259,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1477,20 +1441,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1605,20 +1563,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1739,20 +1691,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1872,20 +1818,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -2005,20 +1945,14 @@ impl UsageMeteringAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; diff --git a/src/datadogV2/api/api_users.rs b/src/datadogV2/api/api_users.rs index 4205387f40..c6bc31f8d5 100644 --- a/src/datadogV2/api/api_users.rs +++ b/src/datadogV2/api/api_users.rs @@ -267,20 +267,14 @@ impl UsersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -406,20 +400,14 @@ impl UsersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -508,20 +496,14 @@ impl UsersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -614,20 +596,14 @@ impl UsersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -720,20 +696,14 @@ impl UsersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -829,20 +799,14 @@ impl UsersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1002,20 +966,14 @@ impl UsersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1108,20 +1066,14 @@ impl UsersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; + } // build body parameters let output = Vec::new(); @@ -1264,20 +1216,14 @@ impl UsersAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/src/datadogV2/api/api_workflow_automation.rs b/src/datadogV2/api/api_workflow_automation.rs index 2af542cdae..bd838aaf0d 100644 --- a/src/datadogV2/api/api_workflow_automation.rs +++ b/src/datadogV2/api/api_workflow_automation.rs @@ -228,20 +228,14 @@ impl WorkflowAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -335,20 +329,14 @@ impl WorkflowAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -495,20 +483,14 @@ impl WorkflowAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); @@ -635,20 +617,14 @@ impl WorkflowAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -735,20 +711,14 @@ impl WorkflowAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -849,20 +819,14 @@ impl WorkflowAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -976,20 +940,14 @@ impl WorkflowAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; @@ -1086,20 +1044,14 @@ impl WorkflowAutomationAPI { }; // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + for (key, value) in local_configuration.auth_headers() { headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), + reqwest::header::HeaderName::from_bytes(key.as_bytes()) + .expect("failed to parse auth header name"), + HeaderValue::from_str(value.as_str()) + .expect("failed to parse auth header value"), ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; + } // build body parameters let output = Vec::new(); diff --git a/tests/configuration_test.rs b/tests/configuration_test.rs new file mode 100644 index 0000000000..d3b9b378db --- /dev/null +++ b/tests/configuration_test.rs @@ -0,0 +1,148 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use datadog_api_client::datadog::{APIKey, Configuration}; +use std::env; +use std::sync::Mutex; + +// Mutex to prevent env var tests from interfering with each other +static ENV_MUTEX: Mutex<()> = Mutex::new(()); + +#[test] +fn test_set_pat_stores_pat() { + let mut config = Configuration::new(); + config.set_pat("my-pat-token".to_string()); + + let headers = config.auth_headers(); + assert!(headers + .iter() + .any(|(k, v)| k == "Authorization" && v == "Bearer my-pat-token")); +} + +#[test] +fn test_auth_headers_with_pat_returns_bearer() { + let mut config = Configuration::new(); + config.set_pat("my-pat-token".to_string()); + + let headers = config.auth_headers(); + assert!(headers + .iter() + .any(|(k, v)| k == "Authorization" && v == "Bearer my-pat-token")); +} + +#[test] +fn test_auth_headers_with_pat_and_api_keys_sends_all() { + let mut config = Configuration::new(); + config.set_auth_key( + "apiKeyAuth", + APIKey { + key: "my-api-key".to_string(), + prefix: "".to_string(), + }, + ); + config.set_auth_key( + "appKeyAuth", + APIKey { + key: "my-app-key".to_string(), + prefix: "".to_string(), + }, + ); + config.set_pat("my-pat-token".to_string()); + + let headers = config.auth_headers(); + assert!(headers + .iter() + .any(|(k, v)| k == "Authorization" && v == "Bearer my-pat-token")); + assert!(headers + .iter() + .any(|(k, v)| k == "DD-API-KEY" && v == "my-api-key")); + assert!(headers + .iter() + .any(|(k, v)| k == "DD-APPLICATION-KEY" && v == "my-app-key")); +} + +#[test] +fn test_auth_headers_without_pat_returns_api_keys() { + let _lock = ENV_MUTEX.lock().unwrap(); + let old_pat = env::var("DD_BEARER_TOKEN").ok(); + env::remove_var("DD_BEARER_TOKEN"); + + let mut config = Configuration::new(); + config.set_auth_key( + "apiKeyAuth", + APIKey { + key: "my-api-key".to_string(), + prefix: "".to_string(), + }, + ); + config.set_auth_key( + "appKeyAuth", + APIKey { + key: "my-app-key".to_string(), + prefix: "".to_string(), + }, + ); + + let headers = config.auth_headers(); + assert!(headers + .iter() + .any(|(k, v)| k == "DD-API-KEY" && v == "my-api-key")); + assert!(headers + .iter() + .any(|(k, v)| k == "DD-APPLICATION-KEY" && v == "my-app-key")); + // No Authorization header should be present + assert!(!headers.iter().any(|(k, _)| k == "Authorization")); + + match old_pat { + Some(v) => env::set_var("DD_BEARER_TOKEN", v), + None => env::remove_var("DD_BEARER_TOKEN"), + } +} + +#[test] +fn test_dd_bearer_token_env_var() { + let _lock = ENV_MUTEX.lock().unwrap(); + let old_pat = env::var("DD_BEARER_TOKEN").ok(); + + env::set_var("DD_BEARER_TOKEN", "env-pat-token"); + + let config = Configuration::default(); + + let headers = config.auth_headers(); + assert!(headers + .iter() + .any(|(k, v)| k == "Authorization" && v == "Bearer env-pat-token")); + + // Restore env + match old_pat { + Some(v) => env::set_var("DD_BEARER_TOKEN", v), + None => env::remove_var("DD_BEARER_TOKEN"), + } +} + +#[test] +fn test_empty_dd_pat_does_not_set_pat() { + let _lock = ENV_MUTEX.lock().unwrap(); + let old_pat = env::var("DD_BEARER_TOKEN").ok(); + let old_app_key = env::var("DD_APP_KEY").ok(); + + env::set_var("DD_BEARER_TOKEN", ""); + env::set_var("DD_APP_KEY", "my-app-key"); + + let config = Configuration::default(); + + let headers = config.auth_headers(); + assert!(headers + .iter() + .any(|(k, v)| k == "DD-APPLICATION-KEY" && v == "my-app-key")); + + // Restore env + match old_pat { + Some(v) => env::set_var("DD_BEARER_TOKEN", v), + None => env::remove_var("DD_BEARER_TOKEN"), + } + match old_app_key { + Some(v) => env::set_var("DD_APP_KEY", v), + None => env::remove_var("DD_APP_KEY"), + } +}