|
2 | 2 |
|
3 | 3 | #############################################################################
|
4 | 4 | # #
|
5 |
| -# importAsset.sh : Import asset into a project # |
| 5 | +# importAsset.sh : Import asset into a project # |
6 | 6 | # #
|
7 | 7 | #############################################################################
|
8 | 8 |
|
@@ -187,26 +187,29 @@ function importSingleRefData(){
|
187 | 187 | FILE=./${source_type}.csv
|
188 | 188 | formKey="file=@"${FILE}
|
189 | 189 | echod ${formKey}
|
190 |
| - REF_DATA_URL=${LOCAL_DEV_URL}/integration/rest/external/v1/ut-flow/referencedata/${projectID}/${refDataName} |
| 190 | + REF_DATA_URL=${LOCAL_DEV_URL}/apis/v1/rest/projects/${repoName}/referencedata/${refDataName} |
| 191 | + |
191 | 192 | rdJson=$(curl --location --request GET ${REF_DATA_URL} \
|
192 | 193 | --header 'Content-Type: application/json' \
|
193 | 194 | --header 'Accept: application/json' \
|
194 | 195 | -u ${admin_user}:${admin_password})
|
195 |
| - rdExport=$(echo "$rdJson" | jq '.integration.serviceData.referenceData // empty') |
| 196 | + rdExport=$(echo "$rdJson" | jq '.output // empty') |
196 | 197 | if [ -z "$rdExport" ]; then
|
197 | 198 | echo "Refrence Data does not exists, Creating ....:" ${refDataName}
|
198 |
| - POST_REF_DATA_URL=${LOCAL_DEV_URL}/integration/rest/external/v1/ut-flow/referencedata/create/${projectID} |
| 199 | + POST_REF_DATA_URL=${LOCAL_DEV_URL}/apis/v1/rest/projects/${repoName}/referencedata |
| 200 | + method="POST" |
199 | 201 | else
|
200 | 202 | echo "Refrence Data exists, Updating ....:" ${refDataName}
|
201 |
| - POST_REF_DATA_URL=${LOCAL_DEV_URL}/integration/rest/external/v1/ut-flow/referencedata/update/${projectID}/${refDataName} |
| 203 | + POST_REF_DATA_URL=${LOCAL_DEV_URL}/apis/v1/rest/projects/${repoName}/referencedata/${refDataName} |
| 204 | + method="PUT" |
202 | 205 | fi
|
203 |
| - projectPostJson=$(curl --location --request POST ${POST_REF_DATA_URL} \ |
| 206 | + projectPostJson=$(curl --location --request ${method} ${POST_REF_DATA_URL} \ |
204 | 207 | --header 'Accept: application/json' \
|
205 | 208 | --form 'name='"$refDataName" \
|
206 | 209 | --form 'description='"$description" \
|
207 |
| - --form 'field separator='"$columnDelimiter" \ |
208 |
| - --form 'text qualifier='"$releaseCharacter" \ |
209 |
| - --form 'file encoding='"$encodingType" \ |
| 210 | + --form 'field_separator='"$columnDelimiter" \ |
| 211 | + --form 'text_qualifier='"$releaseCharacter" \ |
| 212 | + --form 'file_encoding='"$encodingType" \ |
210 | 213 | --form ${formKey} -u ${admin_user}:${admin_password})
|
211 | 214 | refDataOutput=$(echo "$projectPostJson" | jq -r -c '.integration.message.description')
|
212 | 215 | if [ "$refDataOutput"=="Success" ]; then
|
@@ -251,47 +254,7 @@ function importRefData(){
|
251 | 254 | echod "ProjectID:" ${projectID}
|
252 | 255 | cd ./assets/projectConfigs/referenceData/
|
253 | 256 | for d in * ; do
|
254 |
| - importSingleRefData ${LOCAL_DEV_URL} ${admin_user} ${admin_password} ${repoName} ${d} ${assetType} ${HOME_DIR} ${synchProject} ${source_type} ${projectID} |
255 |
| - # if [ -d "$d" ]; then |
256 |
| - # refDataName="$d" |
257 |
| - # echod "$d" |
258 |
| - # cd "$d" |
259 |
| - # description=$(jq -r .description metadata.json) |
260 |
| - # columnDelimiter=$(jq -r .columnDelimiter metadata.json) |
261 |
| - # encodingType=$(jq -r .encodingType metadata.json) |
262 |
| - # releaseCharacter=$(jq -r .releaseCharacter metadata.json) |
263 |
| - # FILE=./${source_type}.csv |
264 |
| - # formKey="file=@"${FILE} |
265 |
| - # echod ${formKey} |
266 |
| - # REF_DATA_URL=${LOCAL_DEV_URL}/integration/rest/external/v1/ut-flow/referencedata/${projectID}/${refDataName} |
267 |
| - # rdJson=$(curl --location --request GET ${REF_DATA_URL} \ |
268 |
| - # --header 'Content-Type: application/json' \ |
269 |
| - # --header 'Accept: application/json' \ |
270 |
| - # -u ${admin_user}:${admin_password}) |
271 |
| - # rdExport=$(echo "$rdJson" | jq '.integration.serviceData.referenceData // empty') |
272 |
| - # if [ -z "$rdExport" ]; then |
273 |
| - # echo "Refrence Data does not exists, Creating ....:" ${refDataName} |
274 |
| - # POST_REF_DATA_URL=${LOCAL_DEV_URL}/integration/rest/external/v1/ut-flow/referencedata/create/${projectID} |
275 |
| - # else |
276 |
| - # echo "Refrence Data exists, Updating ....:" ${refDataName} |
277 |
| - # POST_REF_DATA_URL=${LOCAL_DEV_URL}/integration/rest/external/v1/ut-flow/referencedata/update/${projectID}/${refDataName} |
278 |
| - # fi |
279 |
| - # projectPostJson=$(curl --location --request POST ${POST_REF_DATA_URL} \ |
280 |
| - # --header 'Accept: application/json' \ |
281 |
| - # --form 'name='"$refDataName" \ |
282 |
| - # --form 'description='"$description" \ |
283 |
| - # --form 'field separator='"$columnDelimiter" \ |
284 |
| - # --form 'text qualifier='"$releaseCharacter" \ |
285 |
| - # --form 'file encoding='"$encodingType" \ |
286 |
| - # --form ${formKey} -u ${admin_user}:${admin_password}) |
287 |
| - # refDataOutput=$(echo "$projectPostJson" | jq -r -c '.integration.message.description') |
288 |
| - # if [ "$refDataOutput"=="Success" ]; then |
289 |
| - # echo "Reference Data created/updated successfully" |
290 |
| - # else |
291 |
| - # echo "Reference Data failed:" ${projectPostJson} |
292 |
| - # fi |
293 |
| - # cd - |
294 |
| - # fi |
| 257 | + importSingleRefData ${LOCAL_DEV_URL} ${admin_user} ${admin_password} ${repoName} ${d} ${assetType} ${HOME_DIR} ${synchProject} ${source_type} ${projectID}- |
295 | 258 | done
|
296 | 259 | fi
|
297 | 260 | cd ${HOME_DIR}/${repoName}
|
|
0 commit comments