mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-25 12:42:47 -08:00
AZURE SD: Validate HTTP config
Related-to #12810 Signed-off-by: Jayapriya Pai <janantha@redhat.com>
This commit is contained in:
parent
7a87d0dd71
commit
e44d5dfb3a
|
@ -1769,6 +1769,10 @@ var expectedErrors = []struct {
|
||||||
filename: "azure_authentication_method.bad.yml",
|
filename: "azure_authentication_method.bad.yml",
|
||||||
errMsg: "unknown authentication_type \"invalid\". Supported types are \"OAuth\" or \"ManagedIdentity\"",
|
errMsg: "unknown authentication_type \"invalid\". Supported types are \"OAuth\" or \"ManagedIdentity\"",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
filename: "azure_bearertoken_basicauth.bad.yml",
|
||||||
|
errMsg: "at most one of basic_auth, oauth2, bearer_token & bearer_token_file must be configured",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
filename: "empty_scrape_config.bad.yml",
|
filename: "empty_scrape_config.bad.yml",
|
||||||
errMsg: "empty or null scrape config section",
|
errMsg: "empty or null scrape config section",
|
||||||
|
|
11
config/testdata/azure_bearertoken_basicauth.bad.yml
vendored
Normal file
11
config/testdata/azure_bearertoken_basicauth.bad.yml
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
scrape_configs:
|
||||||
|
- job_name: prometheus
|
||||||
|
azure_sd_configs:
|
||||||
|
- subscription_id: 11AAAA11-A11A-111A-A111-1111A1111A11
|
||||||
|
tenant_id: BBBB222B-B2B2-2B22-B222-2BB2222BB2B2
|
||||||
|
client_id: 333333CC-3C33-3333-CCC3-33C3CCCCC33C
|
||||||
|
client_secret: mysecret
|
||||||
|
bearer_token: 1234
|
||||||
|
basic_auth:
|
||||||
|
username: user
|
||||||
|
password: password
|
|
@ -144,7 +144,7 @@ func (c *SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||||
return fmt.Errorf("unknown authentication_type %q. Supported types are %q or %q", c.AuthenticationMethod, authMethodOAuth, authMethodManagedIdentity)
|
return fmt.Errorf("unknown authentication_type %q. Supported types are %q or %q", c.AuthenticationMethod, authMethodOAuth, authMethodManagedIdentity)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return c.HTTPClientConfig.Validate()
|
||||||
}
|
}
|
||||||
|
|
||||||
type Discovery struct {
|
type Discovery struct {
|
||||||
|
|
Loading…
Reference in a new issue