Skip to content

Commit

Permalink
Disabled regions should be skipped in `config_enabled_all_regions.sql…
Browse files Browse the repository at this point in the history
…` query (#437)
  • Loading branch information
yorinasub17 authored Jul 7, 2022
1 parent 0472824 commit aded5eb
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions query/config/config_enabled_all_regions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,30 @@ select
and status ->> 'Recording' = 'true'
and status ->> 'LastStatus' = 'SUCCESS'
then 'ok'
-- Skip any regions that are disabled in the account.
when a.opt_in_status = 'not-opted-in' then 'skip'
else 'alarm'
end as status,
-- Below cases are for citing respective reasons for control state
case
when recording_group -> 'IncludeGlobalResourceTypes' = 'true' then a.region || ' IncludeGlobalResourceTypes enabled,'
else a.region || ' IncludeGlobalResourceTypes disabled,'
end ||
case
when recording_group -> 'AllSupported' = 'true' then ' AllSupported enabled,'
else ' AllSupported disabled,'
end ||
case
when status ->> 'Recording' = 'true' then ' Recording enabled'
else ' Recording disabled'
end ||
case
when status ->> 'LastStatus' = 'SUCCESS' then ' and LastStatus is SUCCESS.'
else ' and LastStatus is not SUCCESS.'
when a.opt_in_status = 'not-opted-in' then a.region || ' region is disabled.'
else
case
when recording_group -> 'IncludeGlobalResourceTypes' = 'true' then a.region || ' IncludeGlobalResourceTypes enabled,'
else a.region || ' IncludeGlobalResourceTypes disabled,'
end ||
case
when recording_group -> 'AllSupported' = 'true' then ' AllSupported enabled,'
else ' AllSupported disabled,'
end ||
case
when status ->> 'Recording' = 'true' then ' Recording enabled'
else ' Recording disabled'
end ||
case
when status ->> 'LastStatus' = 'SUCCESS' then ' and LastStatus is SUCCESS.'
else ' and LastStatus is not SUCCESS.'
end
end as reason,
-- Additional columns
a.region,
Expand Down

0 comments on commit aded5eb

Please sign in to comment.