Skip to content

Commit

Permalink
Add runtime configuration validation (#8883)
Browse files Browse the repository at this point in the history
* Sync config models

* update

* Update spec.yaml
  • Loading branch information
ofek authored Mar 31, 2021
1 parent 2f5f8b8 commit 8b23ba9
Show file tree
Hide file tree
Showing 6 changed files with 478 additions and 0 deletions.
1 change: 1 addition & 0 deletions amazon_msk/assets/configuration/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ files:
- template: instances/openmetrics_legacy
overrides:
prometheus_url.hidden: true
prometheus_url.required: false
18 changes: 18 additions & 0 deletions amazon_msk/datadog_checks/amazon_msk/config_models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# (C) Datadog, Inc. 2021-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from .instance import InstanceConfig
from .shared import SharedConfig


class ConfigMixin:
_config_model_instance: InstanceConfig
_config_model_shared: SharedConfig

@property
def config(self) -> InstanceConfig:
return self._config_model_instance

@property
def shared_config(self) -> SharedConfig:
return self._config_model_shared
260 changes: 260 additions & 0 deletions amazon_msk/datadog_checks/amazon_msk/config_models/defaults.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
# (C) Datadog, Inc. 2021-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from datadog_checks.base.utils.models.fields import get_default_field_value


def shared_proxy(field, value):
return get_default_field_value(field, value)


def shared_service(field, value):
return get_default_field_value(field, value)


def shared_skip_proxy(field, value):
return False


def shared_timeout(field, value):
return 10


def instance_assume_role(field, value):
return get_default_field_value(field, value)


def instance_auth_token(field, value):
return get_default_field_value(field, value)


def instance_auth_type(field, value):
return 'basic'


def instance_aws_host(field, value):
return get_default_field_value(field, value)


def instance_aws_region(field, value):
return get_default_field_value(field, value)


def instance_aws_service(field, value):
return get_default_field_value(field, value)


def instance_bearer_token_auth(field, value):
return False


def instance_bearer_token_path(field, value):
return get_default_field_value(field, value)


def instance_connect_timeout(field, value):
return get_default_field_value(field, value)


def instance_empty_default_hostname(field, value):
return False


def instance_exclude_labels(field, value):
return get_default_field_value(field, value)


def instance_extra_headers(field, value):
return get_default_field_value(field, value)


def instance_headers(field, value):
return get_default_field_value(field, value)


def instance_health_service_check(field, value):
return True


def instance_ignore_metrics(field, value):
return get_default_field_value(field, value)


def instance_ignore_metrics_by_labels(field, value):
return get_default_field_value(field, value)


def instance_jmx_exporter_port(field, value):
return 11001


def instance_kerberos_auth(field, value):
return 'disabled'


def instance_kerberos_cache(field, value):
return get_default_field_value(field, value)


def instance_kerberos_delegate(field, value):
return False


def instance_kerberos_force_initiate(field, value):
return False


def instance_kerberos_hostname(field, value):
return get_default_field_value(field, value)


def instance_kerberos_keytab(field, value):
return get_default_field_value(field, value)


def instance_kerberos_principal(field, value):
return get_default_field_value(field, value)


def instance_label_joins(field, value):
return get_default_field_value(field, value)


def instance_label_to_hostname(field, value):
return get_default_field_value(field, value)


def instance_labels_mapper(field, value):
return get_default_field_value(field, value)


def instance_log_requests(field, value):
return False


def instance_metrics(field, value):
return get_default_field_value(field, value)


def instance_min_collection_interval(field, value):
return 15


def instance_namespace(field, value):
return 'service'


def instance_node_exporter_port(field, value):
return 11002


def instance_ntlm_domain(field, value):
return get_default_field_value(field, value)


def instance_password(field, value):
return get_default_field_value(field, value)


def instance_persist_connections(field, value):
return False


def instance_prometheus_metrics_path(field, value):
return '/metrics'


def instance_prometheus_metrics_prefix(field, value):
return get_default_field_value(field, value)


def instance_prometheus_url(field, value):
return get_default_field_value(field, value)


def instance_proxy(field, value):
return get_default_field_value(field, value)


def instance_read_timeout(field, value):
return get_default_field_value(field, value)


def instance_region_name(field, value):
return get_default_field_value(field, value)


def instance_send_distribution_buckets(field, value):
return False


def instance_send_distribution_counts_as_monotonic(field, value):
return False


def instance_send_distribution_sums_as_monotonic(field, value):
return False


def instance_send_histograms_buckets(field, value):
return True


def instance_send_monotonic_counter(field, value):
return True


def instance_send_monotonic_with_gauge(field, value):
return False


def instance_service(field, value):
return get_default_field_value(field, value)


def instance_skip_proxy(field, value):
return False


def instance_tags(field, value):
return get_default_field_value(field, value)


def instance_timeout(field, value):
return 10


def instance_tls_ca_cert(field, value):
return get_default_field_value(field, value)


def instance_tls_cert(field, value):
return get_default_field_value(field, value)


def instance_tls_ignore_warning(field, value):
return False


def instance_tls_private_key(field, value):
return get_default_field_value(field, value)


def instance_tls_use_host_header(field, value):
return False


def instance_tls_verify(field, value):
return True


def instance_type_overrides(field, value):
return get_default_field_value(field, value)


def instance_use_legacy_auth_encoding(field, value):
return True


def instance_username(field, value):
return get_default_field_value(field, value)
Loading

0 comments on commit 8b23ba9

Please sign in to comment.