Skip to content

Commit cc0c76c

Browse files
committed
updated json single object support
1 parent ae1e1f2 commit cc0c76c

File tree

1 file changed

+41
-5
lines changed

1 file changed

+41
-5
lines changed

psvar-processor.sh

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ create_json_file_format()
4848
# rm -rf fetched_parameters.json
4949
}
5050

51+
create_jsonso_file_format()
52+
{
53+
file_name=$1
54+
fetch_path=$2
55+
echo $fetch_path
56+
echo $file_name
57+
echo "aws ssm get-parameters --with-decryption --name $fetch_path | jq '.Parameters | .[] | .Value' | jq '.|fromjson'"
58+
aws ssm get-parameters --with-decryption --name $fetch_path | jq '.Parameters | .[] | .Value' | jq '.|fromjson' >${file_name}.json
59+
# rm -rf fetched_parameters.json
60+
}
61+
5162
fetching_specific_path()
5263
{
5364
type_to_fetch=$1
@@ -67,7 +78,11 @@ fetching_specific_path()
6778
if [ "$type_to_fetch" == "appjson" ]
6879
then
6980
create_json_file_format $fname $fpath
70-
fi
81+
fi
82+
if [ "$type_to_fetch" == "appjsonso" ]
83+
then
84+
create_jsonso_file_format $fname $fpath
85+
fi
7186
}
7287

7388
fetching_multiple_path()
@@ -90,7 +105,11 @@ fetching_multiple_path()
90105
if [ "$type_to_fetch" == "appjson" ]
91106
then
92107
create_json_file_format $fname $fpath
93-
fi
108+
fi
109+
if [ "$type_to_fetch" == "appjsonso" ]
110+
then
111+
create_jsonso_file_format $fname $fpath
112+
fi
94113
done
95114
}
96115

@@ -136,7 +155,7 @@ then
136155
fi
137156
if [ -z $PS_PATH_LIST ];
138157
then
139-
echo "Info: no path list"
158+
echo "Info: no path list provided. So skipping pathlist"
140159
else
141160
fetching_multiple_path $APP_TYPE_LOWERCASE
142161
fi
@@ -153,7 +172,7 @@ then
153172
fi
154173
if [ -z $PS_PATH_LIST ];
155174
then
156-
echo "Info: no path list"
175+
echo "Info: no path list provided. So skipping pathlist"
157176
else
158177
fetching_multiple_path $APP_TYPE_LOWERCASE
159178
fi
@@ -170,7 +189,24 @@ then
170189
fi
171190
if [ -z $PS_PATH_LIST ];
172191
then
173-
echo "Info: no path list"
192+
echo "Info: no path list provided. So skipping pathlist"
193+
else
194+
fetching_multiple_path $APP_TYPE_LOWERCASE
195+
fi
196+
fi
197+
198+
if [ "$APP_TYPE_LOWERCASE" == "appjsonso" ]
199+
then
200+
echo "json file configuration"
201+
if [ -z $PS_PATH ];
202+
then
203+
echo "Info: no ps path"
204+
else
205+
fetching_specific_path $APP_TYPE_LOWERCASE
206+
fi
207+
if [ -z $PS_PATH_LIST ];
208+
then
209+
echo "Info: no path list provided. So skipping pathlist"
174210
else
175211
fetching_multiple_path $APP_TYPE_LOWERCASE
176212
fi

0 commit comments

Comments
 (0)