Skip to content

Commit

Permalink
Fix the type of bearer_token_auth (#11144)
Browse files Browse the repository at this point in the history
  • Loading branch information
L3n41c committed Jan 18, 2022
1 parent c532872 commit 945d005
Show file tree
Hide file tree
Showing 53 changed files with 104 additions and 84 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2021-present
# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

Expand Down Expand Up @@ -51,7 +51,7 @@ def instance_aws_service(field, value):


def instance_bearer_token_auth(field, value):
return False
return get_default_field_value(field, value)


def instance_bearer_token_path(field, value):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2021-present
# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

Expand Down Expand Up @@ -69,7 +69,7 @@ class Config:
aws_host: Optional[str]
aws_region: Optional[str]
aws_service: Optional[str]
bearer_token_auth: Optional[bool]
bearer_token_auth: Optional[Union[bool, str]]
bearer_token_path: Optional[str]
connect_timeout: Optional[float]
disable_generic_tags: Optional[bool]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ instances:
#
# include_labels: []

## @param bearer_token_auth - boolean - optional - default: false
## @param bearer_token_auth - boolean or string - optional - default: false
## If set to true, adds a bearer token authentication header.
## If set to 'tls_only', only adds a bearer token authentication header if the endpoint is secure https.
## Note: If bearer_token_path is not set, the default path is /var/run/secrets/kubernetes.io/serviceaccount/token.
#
# bearer_token_auth: false
Expand Down
4 changes: 2 additions & 2 deletions cilium/datadog_checks/cilium/config_models/defaults.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2021-present
# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

Expand Down Expand Up @@ -55,7 +55,7 @@ def instance_aws_service(field, value):


def instance_bearer_token_auth(field, value):
return False
return get_default_field_value(field, value)


def instance_bearer_token_path(field, value):
Expand Down
4 changes: 2 additions & 2 deletions cilium/datadog_checks/cilium/config_models/instance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2021-present
# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

Expand Down Expand Up @@ -96,7 +96,7 @@ class Config:
aws_host: Optional[str]
aws_region: Optional[str]
aws_service: Optional[str]
bearer_token_auth: Optional[bool]
bearer_token_auth: Optional[Union[bool, str]]
bearer_token_path: Optional[str]
cache_metric_wildcards: Optional[bool]
cache_shared_labels: Optional[bool]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def instance_aws_service(field, value):


def instance_bearer_token_auth(field, value):
return False
return get_default_field_value(field, value)


def instance_bearer_token_path(field, value):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Config:
aws_host: Optional[str]
aws_region: Optional[str]
aws_service: Optional[str]
bearer_token_auth: Optional[bool]
bearer_token_auth: Optional[Union[bool, str]]
bearer_token_path: Optional[str]
cache_metric_wildcards: Optional[bool]
cache_shared_labels: Optional[bool]
Expand Down
2 changes: 1 addition & 1 deletion coredns/datadog_checks/coredns/config_models/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def instance_aws_service(field, value):


def instance_bearer_token_auth(field, value):
return False
return get_default_field_value(field, value)


def instance_bearer_token_path(field, value):
Expand Down
2 changes: 1 addition & 1 deletion coredns/datadog_checks/coredns/config_models/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Config:
aws_host: Optional[str]
aws_region: Optional[str]
aws_service: Optional[str]
bearer_token_auth: Optional[bool]
bearer_token_auth: Optional[Union[bool, str]]
bearer_token_path: Optional[str]
cache_metric_wildcards: Optional[bool]
cache_shared_labels: Optional[bool]
Expand Down
4 changes: 2 additions & 2 deletions crio/datadog_checks/crio/config_models/defaults.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2021-present
# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

Expand Down Expand Up @@ -51,7 +51,7 @@ def instance_aws_service(field, value):


def instance_bearer_token_auth(field, value):
return False
return get_default_field_value(field, value)


def instance_bearer_token_path(field, value):
Expand Down
4 changes: 2 additions & 2 deletions crio/datadog_checks/crio/config_models/instance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2021-present
# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

Expand Down Expand Up @@ -69,7 +69,7 @@ class Config:
aws_host: Optional[str]
aws_region: Optional[str]
aws_service: Optional[str]
bearer_token_auth: Optional[bool]
bearer_token_auth: Optional[Union[bool, str]]
bearer_token_path: Optional[str]
connect_timeout: Optional[float]
disable_generic_tags: Optional[bool]
Expand Down
3 changes: 2 additions & 1 deletion crio/datadog_checks/crio/data/conf.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ instances:
#
# include_labels: []

## @param bearer_token_auth - boolean - optional - default: false
## @param bearer_token_auth - boolean or string - optional - default: false
## If set to true, adds a bearer token authentication header.
## If set to 'tls_only', only adds a bearer token authentication header if the endpoint is secure https.
## Note: If bearer_token_path is not set, the default path is /var/run/secrets/kubernetes.io/serviceaccount/token.
#
# bearer_token_auth: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,13 @@
- name: bearer_token_auth
description: |
If set to true, adds a bearer token authentication header.
If set to 'tls_only', only adds a bearer token authentication header if the endpoint is secure https.
Note: If bearer_token_path is not set, the default path is /var/run/secrets/kubernetes.io/serviceaccount/token.
value:
example: false
type: boolean
anyOf:
- type: boolean
- type: string
- name: bearer_token_path
description: |
The path to a Kubernetes service account bearer token file. Make sure the file exists and is mounted correctly.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2021-present
# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

Expand Down Expand Up @@ -51,7 +51,7 @@ def instance_aws_service(field, value):


def instance_bearer_token_auth(field, value):
return False
return get_default_field_value(field, value)


def instance_bearer_token_path(field, value):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2021-present
# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

Expand Down Expand Up @@ -69,7 +69,7 @@ class Config:
aws_host: Optional[str]
aws_region: Optional[str]
aws_service: Optional[str]
bearer_token_auth: Optional[bool]
bearer_token_auth: Optional[Union[bool, str]]
bearer_token_path: Optional[str]
connect_timeout: Optional[float]
disable_generic_tags: Optional[bool]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,9 @@ instances:
#
# include_labels: []

## @param bearer_token_auth - boolean - optional - default: false
## @param bearer_token_auth - boolean or string - optional - default: false
## If set to true, adds a bearer token authentication header.
## If set to 'tls_only', only adds a bearer token authentication header if the endpoint is secure https.
## Note: If bearer_token_path is not set, the default path is /var/run/secrets/kubernetes.io/serviceaccount/token.
#
# bearer_token_auth: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ instances:
#
# include_labels: []

## @param bearer_token_auth - boolean - optional - default: false
## @param bearer_token_auth - boolean or string - optional - default: false
## If set to true, adds a bearer token authentication header.
## If set to 'tls_only', only adds a bearer token authentication header if the endpoint is secure https.
## Note: If bearer_token_path is not set, the default path is /var/run/secrets/kubernetes.io/serviceaccount/token.
#
# bearer_token_auth: false
Expand Down
4 changes: 2 additions & 2 deletions etcd/datadog_checks/etcd/config_models/defaults.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2021-present
# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

Expand Down Expand Up @@ -51,7 +51,7 @@ def instance_aws_service(field, value):


def instance_bearer_token_auth(field, value):
return False
return get_default_field_value(field, value)


def instance_bearer_token_path(field, value):
Expand Down
4 changes: 2 additions & 2 deletions etcd/datadog_checks/etcd/config_models/instance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2021-present
# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

Expand Down Expand Up @@ -69,7 +69,7 @@ class Config:
aws_host: Optional[str]
aws_region: Optional[str]
aws_service: Optional[str]
bearer_token_auth: Optional[bool]
bearer_token_auth: Optional[Union[bool, str]]
bearer_token_path: Optional[str]
connect_timeout: Optional[float]
disable_generic_tags: Optional[bool]
Expand Down
3 changes: 2 additions & 1 deletion etcd/datadog_checks/etcd/data/conf.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ instances:
#
# include_labels: []

## @param bearer_token_auth - boolean - optional - default: false
## @param bearer_token_auth - boolean or string - optional - default: false
## If set to true, adds a bearer token authentication header.
## If set to 'tls_only', only adds a bearer token authentication header if the endpoint is secure https.
## Note: If bearer_token_path is not set, the default path is /var/run/secrets/kubernetes.io/serviceaccount/token.
#
# bearer_token_auth: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2021-present
# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

Expand Down Expand Up @@ -51,7 +51,7 @@ def instance_aws_service(field, value):


def instance_bearer_token_auth(field, value):
return False
return get_default_field_value(field, value)


def instance_bearer_token_path(field, value):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2021-present
# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

Expand Down Expand Up @@ -69,7 +69,7 @@ class Config:
aws_host: Optional[str]
aws_region: Optional[str]
aws_service: Optional[str]
bearer_token_auth: Optional[bool]
bearer_token_auth: Optional[Union[bool, str]]
bearer_token_path: Optional[str]
connect_timeout: Optional[float]
disable_generic_tags: Optional[bool]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ instances:
#
# include_labels: []

## @param bearer_token_auth - boolean - optional - default: false
## @param bearer_token_auth - boolean or string - optional - default: false
## If set to true, adds a bearer token authentication header.
## If set to 'tls_only', only adds a bearer token authentication header if the endpoint is secure https.
## Note: If bearer_token_path is not set, the default path is /var/run/secrets/kubernetes.io/serviceaccount/token.
#
# bearer_token_auth: false
Expand Down
4 changes: 2 additions & 2 deletions gitlab/datadog_checks/gitlab/config_models/defaults.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2021-present
# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

Expand Down Expand Up @@ -59,7 +59,7 @@ def instance_aws_service(field, value):


def instance_bearer_token_auth(field, value):
return False
return get_default_field_value(field, value)


def instance_bearer_token_path(field, value):
Expand Down
4 changes: 2 additions & 2 deletions gitlab/datadog_checks/gitlab/config_models/instance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2021-present
# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

Expand Down Expand Up @@ -70,7 +70,7 @@ class Config:
aws_host: Optional[str]
aws_region: Optional[str]
aws_service: Optional[str]
bearer_token_auth: Optional[bool]
bearer_token_auth: Optional[Union[bool, str]]
bearer_token_path: Optional[str]
connect_timeout: Optional[float]
disable_generic_tags: Optional[bool]
Expand Down
3 changes: 2 additions & 1 deletion gitlab/datadog_checks/gitlab/data/conf.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ instances:
#
# include_labels: []

## @param bearer_token_auth - boolean - optional - default: false
## @param bearer_token_auth - boolean or string - optional - default: false
## If set to true, adds a bearer token authentication header.
## If set to 'tls_only', only adds a bearer token authentication header if the endpoint is secure https.
## Note: If bearer_token_path is not set, the default path is /var/run/secrets/kubernetes.io/serviceaccount/token.
#
# bearer_token_auth: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2021-present
# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

Expand Down Expand Up @@ -51,7 +51,7 @@ def instance_aws_service(field, value):


def instance_bearer_token_auth(field, value):
return False
return get_default_field_value(field, value)


def instance_bearer_token_path(field, value):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2021-present
# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

Expand Down Expand Up @@ -69,7 +69,7 @@ class Config:
aws_host: Optional[str]
aws_region: Optional[str]
aws_service: Optional[str]
bearer_token_auth: Optional[bool]
bearer_token_auth: Optional[Union[bool, str]]
bearer_token_path: Optional[str]
connect_timeout: Optional[float]
disable_generic_tags: Optional[bool]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ instances:
#
# include_labels: []

## @param bearer_token_auth - boolean - optional - default: false
## @param bearer_token_auth - boolean or string - optional - default: false
## If set to true, adds a bearer token authentication header.
## If set to 'tls_only', only adds a bearer token authentication header if the endpoint is secure https.
## Note: If bearer_token_path is not set, the default path is /var/run/secrets/kubernetes.io/serviceaccount/token.
#
# bearer_token_auth: false
Expand Down
4 changes: 2 additions & 2 deletions haproxy/datadog_checks/haproxy/config_models/defaults.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2021-present
# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

Expand Down Expand Up @@ -55,7 +55,7 @@ def instance_aws_service(field, value):


def instance_bearer_token_auth(field, value):
return False
return get_default_field_value(field, value)


def instance_bearer_token_path(field, value):
Expand Down
Loading

0 comments on commit 945d005

Please sign in to comment.