1 """Config flow for sentry integration."""
3 from __future__
import annotations
8 from sentry_sdk.utils
import BadDsn, Dsn
9 import voluptuous
as vol
22 CONF_EVENT_CUSTOM_COMPONENTS,
24 CONF_EVENT_THIRD_PARTY_PACKAGES,
25 CONF_LOGGING_EVENT_LEVEL,
28 CONF_TRACING_SAMPLE_RATE,
29 DEFAULT_LOGGING_EVENT_LEVEL,
30 DEFAULT_LOGGING_LEVEL,
31 DEFAULT_TRACING_SAMPLE_RATE,
36 _LOGGER = logging.getLogger(__name__)
38 DATA_SCHEMA = vol.Schema({vol.Required(CONF_DSN): str})
42 """Handle a Sentry config flow."""
49 config_entry: ConfigEntry,
50 ) -> SentryOptionsFlow:
51 """Get the options flow for this handler."""
55 self, user_input: dict[str, Any] |
None =
None
56 ) -> ConfigFlowResult:
57 """Handle a user config flow."""
62 if user_input
is not None:
64 Dsn(user_input[
"dsn"])
66 errors[
"base"] =
"bad_dsn"
68 _LOGGER.exception(
"Unexpected exception")
69 errors[
"base"] =
"unknown"
74 step_id=
"user", data_schema=DATA_SCHEMA, errors=errors
79 """Handle Sentry options."""
82 self, user_input: dict[str, Any] |
None =
None
83 ) -> ConfigFlowResult:
84 """Manage Sentry options."""
85 if user_input
is not None:
90 data_schema=vol.Schema(
93 CONF_LOGGING_EVENT_LEVEL,
95 CONF_LOGGING_EVENT_LEVEL, DEFAULT_LOGGING_EVENT_LEVEL
97 ): vol.In(LOGGING_LEVELS),
101 CONF_LOGGING_LEVEL, DEFAULT_LOGGING_LEVEL
103 ): vol.In(LOGGING_LEVELS),
111 CONF_EVENT_HANDLED,
False
115 CONF_EVENT_CUSTOM_COMPONENTS,
117 CONF_EVENT_CUSTOM_COMPONENTS,
False
121 CONF_EVENT_THIRD_PARTY_PACKAGES,
123 CONF_EVENT_THIRD_PARTY_PACKAGES,
False
131 CONF_TRACING_SAMPLE_RATE,
133 CONF_TRACING_SAMPLE_RATE, DEFAULT_TRACING_SAMPLE_RATE
135 ): vol.All(vol.Coerce(float), vol.Range(min=0.0, max=1.0)),
SentryOptionsFlow async_get_options_flow(ConfigEntry config_entry)
ConfigFlowResult async_step_user(self, dict[str, Any]|None user_input=None)
ConfigFlowResult async_step_init(self, dict[str, Any]|None user_input=None)
ConfigFlowResult async_create_entry(self, *str title, Mapping[str, Any] data, str|None description=None, Mapping[str, str]|None description_placeholders=None, Mapping[str, Any]|None options=None)
list[ConfigEntry] _async_current_entries(self, bool|None include_ignore=None)
ConfigFlowResult async_abort(self, *str reason, Mapping[str, str]|None description_placeholders=None)
ConfigFlowResult async_show_form(self, *str|None step_id=None, vol.Schema|None data_schema=None, dict[str, str]|None errors=None, Mapping[str, str]|None description_placeholders=None, bool|None last_step=None, str|None preview=None)
ConfigEntry config_entry(self)
None config_entry(self, ConfigEntry value)
_FlowResultT async_show_form(self, *str|None step_id=None, vol.Schema|None data_schema=None, dict[str, str]|None errors=None, Mapping[str, str]|None description_placeholders=None, bool|None last_step=None, str|None preview=None)
_FlowResultT async_create_entry(self, *str|None title=None, Mapping[str, Any] data, str|None description=None, Mapping[str, str]|None description_placeholders=None)
_FlowResultT async_abort(self, *str reason, Mapping[str, str]|None description_placeholders=None)