fix(s3-bridge): check for unobtainable credentials in healthcheck
This commit is contained in:
parent
69c7f858af
commit
a30e8818fd
|
@ -105,7 +105,11 @@ on_stop(InstId, _State = #{pool_name := PoolName}) ->
|
||||||
-spec on_get_status(_InstanceId :: resource_id(), state()) ->
|
-spec on_get_status(_InstanceId :: resource_id(), state()) ->
|
||||||
health_check_status().
|
health_check_status().
|
||||||
on_get_status(_InstId, State = #{client_config := Config}) ->
|
on_get_status(_InstId, State = #{client_config := Config}) ->
|
||||||
try erlcloud_s3:list_buckets(emqx_s3_client:aws_config(Config)) of
|
case emqx_s3_client:aws_config(Config) of
|
||||||
|
{error, Reason} ->
|
||||||
|
{?status_disconnected, State, Reason};
|
||||||
|
AWSConfig ->
|
||||||
|
try erlcloud_s3:list_buckets(AWSConfig) of
|
||||||
Props when is_list(Props) ->
|
Props when is_list(Props) ->
|
||||||
?status_connected
|
?status_connected
|
||||||
catch
|
catch
|
||||||
|
@ -113,6 +117,7 @@ on_get_status(_InstId, State = #{client_config := Config}) ->
|
||||||
{?status_disconnected, State, Reason};
|
{?status_disconnected, State, Reason};
|
||||||
error:{aws_error, {socket_error, Reason}} ->
|
error:{aws_error, {socket_error, Reason}} ->
|
||||||
{?status_disconnected, State, Reason}
|
{?status_disconnected, State, Reason}
|
||||||
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec on_add_channel(_InstanceId :: resource_id(), state(), channel_id(), channel_config()) ->
|
-spec on_add_channel(_InstanceId :: resource_id(), state(), channel_id(), channel_config()) ->
|
||||||
|
|
Loading…
Reference in New Issue