mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 14:27:07 +00:00
Use core constants for aws (#46017)
This commit is contained in:
parent
5d3dcff7c9
commit
60268e63d9
@ -7,7 +7,12 @@ import aiobotocore
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.const import ATTR_CREDENTIALS, CONF_NAME, CONF_PROFILE_NAME
|
from homeassistant.const import (
|
||||||
|
ATTR_CREDENTIALS,
|
||||||
|
CONF_NAME,
|
||||||
|
CONF_PROFILE_NAME,
|
||||||
|
CONF_SERVICE,
|
||||||
|
)
|
||||||
from homeassistant.helpers import config_validation as cv, discovery
|
from homeassistant.helpers import config_validation as cv, discovery
|
||||||
|
|
||||||
# Loading the config flow file will register the flow
|
# Loading the config flow file will register the flow
|
||||||
@ -20,7 +25,6 @@ from .const import (
|
|||||||
CONF_NOTIFY,
|
CONF_NOTIFY,
|
||||||
CONF_REGION,
|
CONF_REGION,
|
||||||
CONF_SECRET_ACCESS_KEY,
|
CONF_SECRET_ACCESS_KEY,
|
||||||
CONF_SERVICE,
|
|
||||||
CONF_VALIDATE,
|
CONF_VALIDATE,
|
||||||
DATA_CONFIG,
|
DATA_CONFIG,
|
||||||
DATA_HASS_CONFIG,
|
DATA_HASS_CONFIG,
|
||||||
@ -152,7 +156,6 @@ async def async_setup_entry(hass, entry):
|
|||||||
|
|
||||||
async def _validate_aws_credentials(hass, credential):
|
async def _validate_aws_credentials(hass, credential):
|
||||||
"""Validate AWS credential config."""
|
"""Validate AWS credential config."""
|
||||||
|
|
||||||
aws_config = credential.copy()
|
aws_config = credential.copy()
|
||||||
del aws_config[CONF_NAME]
|
del aws_config[CONF_NAME]
|
||||||
del aws_config[CONF_VALIDATE]
|
del aws_config[CONF_VALIDATE]
|
||||||
|
@ -10,8 +10,6 @@ CONF_CONTEXT = "context"
|
|||||||
CONF_CREDENTIAL_NAME = "credential_name"
|
CONF_CREDENTIAL_NAME = "credential_name"
|
||||||
CONF_CREDENTIALS = "credentials"
|
CONF_CREDENTIALS = "credentials"
|
||||||
CONF_NOTIFY = "notify"
|
CONF_NOTIFY = "notify"
|
||||||
CONF_PROFILE_NAME = "profile_name"
|
|
||||||
CONF_REGION = "region_name"
|
CONF_REGION = "region_name"
|
||||||
CONF_SECRET_ACCESS_KEY = "aws_secret_access_key"
|
CONF_SECRET_ACCESS_KEY = "aws_secret_access_key"
|
||||||
CONF_SERVICE = "service"
|
|
||||||
CONF_VALIDATE = "validate"
|
CONF_VALIDATE = "validate"
|
||||||
|
@ -12,24 +12,21 @@ from homeassistant.components.notify import (
|
|||||||
ATTR_TITLE_DEFAULT,
|
ATTR_TITLE_DEFAULT,
|
||||||
BaseNotificationService,
|
BaseNotificationService,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_NAME, CONF_PLATFORM
|
from homeassistant.const import (
|
||||||
|
CONF_NAME,
|
||||||
|
CONF_PLATFORM,
|
||||||
|
CONF_PROFILE_NAME,
|
||||||
|
CONF_SERVICE,
|
||||||
|
)
|
||||||
from homeassistant.helpers.json import JSONEncoder
|
from homeassistant.helpers.json import JSONEncoder
|
||||||
|
|
||||||
from .const import (
|
from .const import CONF_CONTEXT, CONF_CREDENTIAL_NAME, CONF_REGION, DATA_SESSIONS
|
||||||
CONF_CONTEXT,
|
|
||||||
CONF_CREDENTIAL_NAME,
|
|
||||||
CONF_PROFILE_NAME,
|
|
||||||
CONF_REGION,
|
|
||||||
CONF_SERVICE,
|
|
||||||
DATA_SESSIONS,
|
|
||||||
)
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def get_available_regions(hass, service):
|
async def get_available_regions(hass, service):
|
||||||
"""Get available regions for a service."""
|
"""Get available regions for a service."""
|
||||||
|
|
||||||
session = aiobotocore.get_session()
|
session = aiobotocore.get_session()
|
||||||
# get_available_regions is not a coroutine since it does not perform
|
# get_available_regions is not a coroutine since it does not perform
|
||||||
# network I/O. But it still perform file I/O heavily, so put it into
|
# network I/O. But it still perform file I/O heavily, so put it into
|
||||||
|
Loading…
x
Reference in New Issue
Block a user