Skip to content

Commit 39eb770

Browse files
author
will
committed
changes to work with Oracle OCI
1 parent 89544d4 commit 39eb770

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

custom_components/s3/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
CONF_REGION = "region_name"
1717
CONF_ACCESS_KEY_ID = "aws_access_key_id"
1818
CONF_SECRET_ACCESS_KEY = "aws_secret_access_key"
19+
CONF_ENDPOINT_URL = "endpoint_url"
1920

2021
DOMAIN = "s3"
2122
COPY_SERVICE = "copy"
@@ -49,6 +50,7 @@
4950
"ap-northeast-1",
5051
"ap-south-1",
5152
"sa-east-1",
53+
"us-phoenix-1",
5254
]
5355

5456
STORAGE_CLASSES = [
@@ -68,6 +70,7 @@
6870
vol.Optional(CONF_REGION, default=DEFAULT_REGION): vol.In(SUPPORTED_REGIONS),
6971
vol.Required(CONF_ACCESS_KEY_ID): cv.string,
7072
vol.Required(CONF_SECRET_ACCESS_KEY): cv.string,
73+
vol.Required(CONF_ENDPOINT_URL): cv.string,
7174
}
7275
)
7376

@@ -142,7 +145,7 @@ def copy_file(call):
142145
if s3_client is None:
143146
_LOGGER.error("S3 client instance not found")
144147
return
145-
148+
146149
copy_source = {
147150
'Bucket': bucket_source,
148151
'Key': key_source
@@ -191,6 +194,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
191194
CONF_REGION: entry.data[CONF_REGION],
192195
CONF_ACCESS_KEY_ID: entry.data[CONF_ACCESS_KEY_ID],
193196
CONF_SECRET_ACCESS_KEY: entry.data[CONF_SECRET_ACCESS_KEY],
197+
CONF_ENDPOINT_URL: entry.data[CONF_ENDPOINT_URL],
194198
}
195199
client = boto3.client("s3", **aws_config) # Will not raise error.
196200
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = client
@@ -202,4 +206,4 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
202206

203207
if not hass.data[DOMAIN]:
204208
hass.services.async_remove(DOMAIN, PUT_SERVICE)
205-
return True
209+
return True

custom_components/s3/config_flow.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
CONF_REGION,
77
CONF_ACCESS_KEY_ID,
88
CONF_SECRET_ACCESS_KEY,
9+
CONF_ENDPOINT_URL,
910
DEFAULT_REGION,
1011
SUPPORTED_REGIONS,
1112
)
@@ -19,14 +20,15 @@ async def async_step_user(self, user_input=None):
1920
if user_input is not None:
2021
await self.async_set_unique_id(user_input[CONF_ACCESS_KEY_ID])
2122
self._abort_if_unique_id_configured()
22-
23+
2324
return self.async_create_entry(title=user_input[CONF_ACCESS_KEY_ID], data=user_input)
2425

2526
data_schema = vol.Schema(
2627
{
2728
vol.Optional(CONF_REGION, default=DEFAULT_REGION): vol.In(SUPPORTED_REGIONS),
29+
vol.Required(CONF_ENDPOINT_URL): str,
2830
vol.Required(CONF_ACCESS_KEY_ID): str,
2931
vol.Required(CONF_SECRET_ACCESS_KEY): str,
3032
}
3133
)
32-
return self.async_show_form(step_id="user", data_schema=data_schema)
34+
return self.async_show_form(step_id="user", data_schema=data_schema)

custom_components/s3/strings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"data": {
99
"region_name": "AWS bucket Region",
1010
"aws_access_key_id": "AWS Access Key",
11-
"aws_secret_access_key": "AWS Secret Access Key"
11+
"aws_secret_access_key": "AWS Secret Access Key",
12+
"endpoint_url": "Endpoint URL"
1213
}
1314
}
1415
},

custom_components/s3/translations/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"bucket": "Bucket Name",
1010
"region_name": "Bucket Region",
1111
"aws_access_key_id": "AWS Access Key",
12-
"aws_secret_access_key": "AWS Secret Access Key"
12+
"aws_secret_access_key": "AWS Secret Access Key",
13+
"endpoint_url": "Endpoint URL"
1314
}
1415
}
1516
},

0 commit comments

Comments
 (0)