Commit 4820a20b by Madhan Neethiraj

ATLAS-2088: add dev-test scripts to invoke Atlas REST APIs

parent a32e2b2e
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Shell scripts to make REST calls to Atlas Server using curl.
1. Update env_atlas.sh with details to contact Atlas Server
2. Usage of scripts given below:
--------------------------------------------------------------
| Command | Arguments
|----------------------------------------|--------------------
| admin_status.sh
|
| typedefs_create.sh inputFileName
| typedefs_get.sh [outputFileName]
| typedefs_update.sh inputFileName
| typedefs_delete.sh inputFileName
| classificationdef_get.sh typeName [outputFileName]
| entitydef_get.sh typeName [outputFileName]
| enumdef_get.sh typeName [outputFileName]
| structdef_get.sh typeName [outputFileName]
|
| entity_create.sh inputFileName
| entity_get_by_type_and_unique_attr.sh typeName attrName attrValue [outputFileName]
| entity_get_by_guid.sh guid [outputFileName]
| entity_update.sh inputFileName
| entity_update_by_type_and_unique_attr.sh typeName attrName attrValue inputFileName [outputFileName]
| entity_classifications_add.sh guid inputFileName
| entity_classifications_update.sh guid inputFileName
| entity_classifications_delete.sh guid classification
| entity_classification_bulk.sh inputFileName
| entity_delete_by_guid.sh guid
|
| search_basic.sh [queryString] [typeName] [classificationName] [limit] [offset] [outputFileName]
| search_basic_with_attribute_filters.sh inputFileName
| search_dsl.sh queryString [limit] [offset] [outputFileName]
|
| export_entity_by_guid.sh guid [outputFileName]
| export_entity_by_type_and_attr.sh typeName attrName attrValue [matchType] [fetchType] [outputFileName]
| import_zip.sh inputFileName
-----------------------------------------|--------------------
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Get status of Atlas server
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
url=${ATLAS_URL}/api/atlas/admin/status
output=`${CURL_CMDLINE} -X GET -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${url}`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER}
else
echo "failed with error code: ${ret}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Get an classification-def by name
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
typeName=$1
outputFileName=$2
function checkUsage() {
if [ "${typeName}" == "" ]
then
echo "Usage: $0 type-name [outputFileName]"
exit 1
fi
if [ "${outputFileName}" == "" ]
then
outputFileName=`getDataFilePath "classificationdef-${typeName}.json"`
fi
}
checkUsage
output=`${CURL_CMDLINE} -X GET -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${ATLAS_URL}/api/atlas/v2/types/classificationdef/name/${typeName}`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER} | tee ${outputFileName}
echo "saved to ${outputFileName}"
else
echo "failed with error code: ${ret}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Add a classification to mutiple entities
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
inputFileName=$1
function checkUsage() {
if [ "${inputFileName}" == "" ]
then
echo "Usage: $0 inputFileName"
exit 1
fi
}
checkUsage
url=${ATLAS_URL}/api/atlas/v2/entity/bulk/classification
output=`${CURL_CMDLINE} -X POST -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${url} -d @${inputFileName}`
ret=$?
if [ $ret == 0 ]
then
echo ${output}
else
echo "failed with error code: ${ret}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Add classifications to an entity
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
guid=$1
inputFileName=$2
function checkUsage() {
if [ "${guid}" == "" -o "${inputFileName}" == "" ]
then
echo "Usage: $0 guid inputFileName"
exit 1
fi
}
checkUsage
output=`${CURL_CMDLINE} -X POST -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${ATLAS_URL}/api/atlas/v2/entity/guid/${guid}/classifications -d @${inputFileName}`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER}
else
echo "failed with error code: ${ret}"
echo "${output}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Remove a classification of an entity
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
guid=$1
classification=$2
function checkUsage() {
if [ "${guid}" == "" -o "${classification}" == "" ]
then
echo "Usage: $0 guid classification"
exit 1
fi
}
checkUsage
output=`${CURL_CMDLINE} -X DELETE -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${ATLAS_URL}/api/atlas/v2/entity/guid/${guid}/classification/${classification}`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER}
else
echo "failed with error code: ${ret}"
echo "${output}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Update classifications of an entity
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
guid=$1
inputFileName=$2
function checkUsage() {
if [ "${guid}" == "" -o "${inputFileName}" == "" ]
then
echo "Usage: $0 guid inputFileName"
exit 1
fi
}
checkUsage
output=`${CURL_CMDLINE} -X PUT -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${ATLAS_URL}/api/atlas/v2/entity/guid/${guid}/classifications -d @${inputFileName}`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER}
else
echo "failed with error code: ${ret}"
echo "${output}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Create an entity
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
inputFileName=$1
function checkUsage() {
if [ "${inputFileName}" == "" ]
then
echo "Usage: $0 inputFileName"
exit 1
fi
}
checkUsage
url=${ATLAS_URL}/api/atlas/v2/entity
output=`${CURL_CMDLINE} -X POST -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${url} -d @${inputFileName}`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER}
else
echo "failed with error code: ${ret}"
echo "${output}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Delete an entity given its guid
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
guid=$1
function checkUsage() {
if [ "${guid}" == "" ]
then
echo "Usage: $0 guid"
exit 1
fi
}
checkUsage
url=${ATLAS_URL}/api/atlas/v2/entity/guid/${guid}
output=`${CURL_CMDLINE} -X DELETE -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${url}`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER}
else
echo "failed with error code: ${ret}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Get an entity by guid
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
guid=$1
outputFileName=$2
function checkUsage() {
if [ "${guid}" == "" ]
then
echo "Usage: $0 guid [outputFileName]"
exit 1
fi
if [ "${outputFileName}" == "" ]
then
outputFileName=`getDataFilePath "entity-${guid}.json"`
fi
}
checkUsage
url=${ATLAS_URL}/api/atlas/v2/entity/guid/${guid}
output=`${CURL_CMDLINE} -X GET -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${url}`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER} | tee ${outputFileName}
echo "saved to ${outputFileName}"
else
echo "failed with error code: ${ret}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Get an entity by type and unique attribute
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
typeName=$1
attrName=$2
attrValue=$3
outputFileName=$4
function checkUsage() {
if [ "${typeName}" == "" -o "${attrName}" == "" -o "${attrValue}" == "" ]
then
echo "Usage: $0 typeName attrName attrValue [outputFileName]"
exit 1
fi
}
checkUsage
url=${ATLAS_URL}/api/atlas/v2/entity/uniqueAttribute/type/${typeName}?attr:${attrName}=${attrValue}
output=`${CURL_CMDLINE} -X GET -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${url}`
ret=$?
if [ $ret == 0 ]
then
if [ "${outputFileName}" == "" ]
then
echo ${output} | ${JSON_FORMATTER}
else
echo ${output} | ${JSON_FORMATTER} | tee ${outputFileName}
echo "saved to ${outputFileName}"
fi
else
echo "failed with error code: ${ret}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Update an entity
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
inputFileName=$1
function checkUsage() {
if [ "${inputFileName}" == "" ]
then
echo "Usage: $0 inputFileName"
exit 1
fi
}
checkUsage
url=${ATLAS_URL}/api/atlas/v2/entity
output=`${CURL_CMDLINE} -X POST -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${url} -d @${inputFileName}`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER}
else
echo "failed with error code: ${ret}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Update an entity by type and unique attribute
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
typeName=$1
attrName=$2
attrValue=$3
inputFileName=$4
outputFileName=$5
function checkUsage() {
if [ "${typeName}" == "" -o "${attrName}" == "" -o "${attrValue}" == "" -o "${inputFileName}" == "" ]
then
echo "Usage: $0 typeName attrName attrValue inputFileName [outputFileName]"
exit 1
fi
}
checkUsage
url=${ATLAS_URL}/api/atlas/v2/entity/uniqueAttribute/type/${typeName}/attribute/${attrName}?value=${attrValue}
output=`${CURL_CMDLINE} -X PUT -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${url} -d @${inputFileName}`
ret=$?
if [ $ret == 0 ]
then
if [ "${outputFileName}" == "" ]
then
echo ${output} | ${JSON_FORMATTER}
else
echo ${output} | ${JSON_FORMATTER} | tee ${outputFileName}
echo "saved to ${outputFileName}"
fi
else
echo "failed with error code: ${ret}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Get an entity-def by name
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
typeName=$1
outputFileName=$2
function checkUsage() {
if [ "${typeName}" == "" ]
then
echo "Usage: $0 type-name [outputFileName]"
exit 1
fi
if [ "${outputFileName}" == "" ]
then
outputFileName=`getDataFilePath "entitydef-${typeName}.json"`
fi
}
checkUsage
output=`${CURL_CMDLINE} -X GET -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${ATLAS_URL}/api/atlas/v2/types/entitydef/name/${typeName}`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER} | tee ${outputFileName}
echo "saved to ${outputFileName}"
else
echo "failed with error code: ${ret}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Get an enum-def by name
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
typeName=$1
outputFileName=$2
function checkUsage() {
if [ "${typeName}" == "" ]
then
echo "Usage: $0 type-name [outputFileName]"
exit 1
fi
if [ "${outputFileName}" == "" ]
then
outputFileName=`getDataFilePath "enumdef-${typeName}.json"`
fi
}
checkUsage
output=`${CURL_CMDLINE} -X GET -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${ATLAS_URL}/api/atlas/v2/types/enumdef/name/${typeName}`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER} | tee ${outputFileName}
echo "saved to ${outputFileName}"
else
echo "failed with error code: ${ret}"
fi
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
export ATLAS_URL=http://localhost:21000
export ATLAS_USER=username
export ATLAS_PASS=password
export JSON_FORMATTER="python -mjson.tool"
export CURL_CMDLINE="curl -f "
export DATA_DIR=data
if [ ! -d ${DATA_DIR} ]
then
mkdir -p ${DATA_DIR}
fi
function getDataFilePath() {
local fileName=$1
echo "${DATA_DIR}/${fileName}"
}
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Export an entity by guid
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
guid=$1
outputFileName=$2
function checkUsage() {
if [ "${guid}" == "" ]
then
echo "Usage: $0 guid [outputFileName]"
exit 1
fi
if [ "${outputFileName}" == "" ]
then
outputFileName=`getDataFilePath "export-${guid}.zip"`
fi
}
checkUsage
postBody="{ \"itemsToExport\": [ { \"guid\": \"${guid}\" } ] }"
tmpFileName=/tmp/export_$$.txt
echo ${postBody} >> ${tmpFileName}
${CURL_CMDLINE} -X POST -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/zip" -H "Content-Type: application/json" ${ATLAS_URL}/api/atlas/admin/export -d @${tmpFileName} > ${outputFileName}
ret=$?
if [ $ret == 0 ]
then
echo "saved to ${outputFileName}"
else
echo "failed with error code: ${ret}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Export an entity by type and given attr=value
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
typeName=$1
attrName=$2
attrValue=$3
matchType=$4
fetchType=$5
outputFileName=$6
function checkUsage() {
if [ "${typeName}" == "" -o "${attrName}" == "" -o "${attrValue}" == "" ]
then
echo "Usage: $0 typeName attrName attrValue [matchType] [fetchType] [outputFileName]"
exit 1
fi
if [ "${outputFileName}" == "" ]
then
outputFileName=`getDataFilePath "export-${typeName}-${attrName}.zip"`
fi
if [ "${matchType}" == "" ]
then
matchType="equals"
fi
if [ "${fetchType}" == "" ]
then
fetchType="connected"
fi
}
checkUsage
postBody="{ \"itemsToExport\": [ { \"typeName\": \"${typeName}\", \"uniqueAttributes\": { \"${attrName}\": \"${attrValue}\" } } ], \"options\": { \"matchType\":\"${matchType}\", \"fetchType\":\"${fetchType}\" }}"
tmpFileName=/tmp/export_$$.txt
echo ${postBody} >> ${tmpFileName}
${CURL_CMDLINE} -X POST -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/zip" -H "Content-Type: application/json" ${ATLAS_URL}/api/atlas/admin/export -d @${tmpFileName} > ${outputFileName}
ret=$?
if [ $ret == 0 ]
then
echo "saved to ${outputFileName}"
else
echo "failed with error code: ${ret}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Import entities from a zip file created by export
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
inputFileName=$1
function checkUsage() {
if [ "${inputFileName}" == "" ]
then
echo "Usage: $0 inputFileName"
exit 1
fi
}
checkUsage
output=`${CURL_CMDLINE} -X POST -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: multipart/form-data" -H "Cache-Control: no-cache" -F data=@${inputFileName} request="" ${ATLAS_URL}/api/atlas/admin/import`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER}
echo "imported from ${inputFileName}"
else
echo "failed with error code: ${ret}"
fi
[
{
"typeName": "PII",
"attributes": {
"type": "ccn"
}
}
]
{
"classification": {
"typeName": "FINANCE_PII",
"attributes": {
"type": "ccn",
"notes": "bulk-add"
}
},
"entityGuids": [
"2f57519a-4ec2-4a0f-b37f-59aeee72a338",
"dba348f9-bea2-45cc-bbca-38be48855ce3"
]
}
{
"entity": {
"typeName": "Employee",
"attributes": {
"qualifiedName": "Employee-1",
"name": "John Doe",
"emailAddress": "john.doe@EXAMPLE.COM",
"createdBy": "admin",
"createTime": "2017-08-25T13:15:25.369Z",
"updatedBy": "admin",
"updateTime": "2017-08-25T14:12:45.246Z"
}
}
}
{
"entity": {
"typeName": "Employee",
"attributes": {
"qualifiedName": "Employee-2",
"name": "Anna Scott",
"emailAddress": "anna.scott@EXAMPLE.COM",
"createdBy": "admin",
"createTime": "2017-08-25T14:14:24.349Z",
"updatedBy": "admin",
"updateTime": "2017-08-25T15:13:46.256Z"
}
}
}
{
"entity": {
"typeName": "Employee",
"attributes": {
"qualifiedName": "Employee-1",
"name": "John Doe",
"emailAddress": "john.doe@johndoe.com",
"createdBy": "admin",
"createTime": "2017-08-25T13:15:25.369Z",
"updatedBy": "admin",
"updateTime": "2017-08-25T15:13:43.246Z"
}
}
}
{
"query": "",
"typeName": "Employee",
"classification": "PII",
"excludeDeletedEntities": true,
"entityFilters": {
"attributeName": "name",
"operator": "startsWith",
"attributeValue": "Anna"
},
"tagFilters": {
"condition": "AND",
"criterion": [
{
"attributeName": "type",
"operator": "=",
"attributeValue": "ccn"
},
{
"attributeName": "notes",
"operator": "contains",
"attributeValue": "bulk"
}
]
}
}
{
"enumDefs": [
{
"name": "pii_type",
"category": "ENUM",
"elementDefs": [
{ "ordinal": 1, "value": "ccn" },
{ "ordinal": 2, "value": "ssn" },
{ "ordinal": 3, "value": "mrn" }
]
}
],
"structDefs": [
{
"name": "point_2d",
"category": "STRUCT",
"attributeDefs": [
{
"name": "x",
"typeName": "int",
"cardinality": "SINGLE",
"isIndexable": false,
"isOptional": false,
"isUnique": false
},
{
"name": "y",
"typeName": "int",
"cardinality": "SINGLE",
"isIndexable": false,
"isOptional": false,
"isUnique": false
}
]
}
],
"classificationDefs": [
{
"name": "PII",
"category": "CLASSIFICATION",
"superTypes": [],
"attributeDefs": [
{
"name": "type",
"typeName": "pii_type",
"cardinality": "SINGLE",
"isIndexable": false,
"isOptional": true,
"isUnique": false
}
]
},
{
"name": "FINANCE_PII",
"category": "CLASSIFICATION",
"superTypes": [ "PII" ],
"attributeDefs": [
{
"name": "notes",
"typeName": "string",
"cardinality": "SINGLE",
"isIndexable": false,
"isOptional": true,
"isUnique": false
}
]
},
{
"name": "VENDOR_PII",
"category": "CLASSIFICATION",
"superTypes": [ "PII" ],
"attributeDefs": [
{
"name": "notes",
"typeName": "string",
"cardinality": "SINGLE",
"isIndexable": false,
"isOptional": true,
"isUnique": false
}
]
}
],
"entityDefs": [
{
"name": "Employee",
"category": "ENTITY",
"superTypes": [ "Referenceable" ],
"attributeDefs": [
{
"name": "name",
"typeName": "string",
"cardinality": "SINGLE",
"isIndexable": false,
"isOptional": false,
"isUnique": false
},
{
"name": "createTime",
"typeName": "date",
"cardinality": "SINGLE",
"isIndexable": true,
"isOptional": false,
"isUnique": false
},
{
"name": "createdBy",
"typeName": "string",
"cardinality": "SINGLE",
"isIndexable": false,
"isOptional": false,
"isUnique": false
},
{
"name": "updateTime",
"typeName": "date",
"cardinality": "SINGLE",
"isIndexable": true,
"isOptional": false,
"isUnique": false
},
{
"name": "updatedBy",
"typeName": "string",
"cardinality": "SINGLE",
"isIndexable": false,
"isOptional": false,
"isUnique": false
}
]
}
]
}
{
"enumDefs": [
{ "name": "pii_type" }
],
"structDefs": [
{ "name": "point_2d" }
],
"classificationDefs": [
{ "name": "PII" },
{ "name": "FINANCE_PII" },
{ "name": "VENDOR_PII" }
],
"entityDefs": [
{ "name": "Employee" }
]
}
{
"enumDefs": [ ],
"structDefs": [ ],
"classificationDefs": [ ],
"entityDefs": [
{
"name": "Employee",
"category": "ENTITY",
"superTypes": [ "Referenceable" ],
"attributeDefs": [
{
"name": "name",
"typeName": "string",
"cardinality": "SINGLE",
"isIndexable": false,
"isOptional": false,
"isUnique": false
},
{
"name": "emailAddress",
"typeName": "string",
"cardinality": "SINGLE",
"isIndexable": false,
"isOptional": true,
"isUnique": false
},
{
"name": "createTime",
"typeName": "date",
"cardinality": "SINGLE",
"isIndexable": true,
"isOptional": false,
"isUnique": false
},
{
"name": "createdBy",
"typeName": "string",
"cardinality": "SINGLE",
"isIndexable": false,
"isOptional": false,
"isUnique": false
},
{
"name": "updateTime",
"typeName": "date",
"cardinality": "SINGLE",
"isIndexable": true,
"isOptional": false,
"isUnique": false
},
{
"name": "updatedBy",
"typeName": "string",
"cardinality": "SINGLE",
"isIndexable": false,
"isOptional": false,
"isUnique": false
}
]
}
]
}
[
{
"typeName": "PII",
"attributes": {
"type": "mrn"
}
}
]
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# perform a basic search
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
query=$1
typeName=$2
classificationName=$3
limit=$4
offset=$5
outputFileName=$6
function checkUsage() {
if [ "${query}" == "" -a "${typeName}" == "" -a "${classificationName}" == "" ]
then
echo "Usage: $0 query typeName classificationName [limit] [offset] [outputFileName]"
exit 1
fi
if [ "${limit}" == "" ]
then
limit=-1
fi
if [ "${offset}" == "" ]
then
offset=-1
fi
if [ "${outputFileName}" == "" ]
then
outputFileName=`getDataFilePath "search-basic.json"`
fi
}
checkUsage
output=`${CURL_CMDLINE} -X GET -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${ATLAS_URL}/api/atlas/v2/search/basic?query="${query}"\&typeName="${typeName}"\&classification="${classificationName}"\&excludeDeletedEntities=true\&limit=${limit}\&offset=${offset}`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER} | tee ${outputFileName}
echo "saved to ${outputFileName}"
else
echo "failed with error code: ${ret}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# perform a basic search with attribute filtering
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
inputFileName=$1
outputFileName=$2
function checkUsage() {
if [ "${inputFileName}" == "" ]
then
echo "Usage: $0 inputFileName [outputFileName]"
exit 1
fi
if [ "${outputFileName}" == "" ]
then
outputFileName=`getDataFilePath "earch_basic_with_attribute_filters.json"`
fi
}
checkUsage
output=`${CURL_CMDLINE} -X POST -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${ATLAS_URL}/api/atlas/v2/search/basic -d @${inputFileName}`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER} | tee ${outputFileName}
echo "saved to ${outputFileName}"
else
echo "failed with error code: ${ret}"
echo "${output}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# perform a DSL search
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
query=$1
limit=$2
offset=$3
outputFileName=$4
function checkUsage() {
if [ "${query}" == "" ]
then
echo "Usage: $0 query [limit] [offset] [outputFileName]"
exit 1
fi
if [ "${limit}" == "" ]
then
limit=-1
fi
if [ "${offset}" == "" ]
then
offset=-1
fi
if [ "${outputFileName}" == "" ]
then
outputFileName=`getDataFilePath "search-dsl.json"`
fi
}
checkUsage
output=`${CURL_CMDLINE} -X GET -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${ATLAS_URL}/api/atlas/v2/search/dsl?query="${query}"\&limit=${limit}\&offset=${offset}`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER} | tee ${outputFileName}
echo "saved to ${outputFileName}"
else
echo "failed with error code: ${ret}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Get an struct-def by name
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
typeName=$1
outputFileName=$2
function checkUsage() {
if [ "${typeName}" == "" ]
then
echo "Usage: $0 type-name [outputFileName]"
exit 1
fi
if [ "${outputFileName}" == "" ]
then
outputFileName=`getDataFilePath "structdef-${typeName}.json"`
fi
}
checkUsage
output=`${CURL_CMDLINE} -X GET -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${ATLAS_URL}/api/atlas/v2/types/structdef/name/${typeName}`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER} | tee ${outputFileName}
echo "saved to ${outputFileName}"
else
echo "failed with error code: ${ret}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Create typedefs
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
inputFileName=$1
function checkUsage() {
if [ "${inputFileName}" == "" ]
then
echo "Usage: $0 input-file"
exit 1
fi
if [ ! -f "${inputFileName}" ]
then
echo "${inputFileName}: does not exist"
exit 1
fi
}
checkUsage
output=`${CURL_CMDLINE} -X POST -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${ATLAS_URL}/api/atlas/v2/types/typedefs -d @${inputFileName}`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER}
else
echo "failed with error code: ${ret}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Delete typedefs
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
inputFileName=$1
function checkUsage() {
if [ "${inputFileName}" == "" ]
then
echo "Usage: $0 input-file"
exit 1
fi
if [ ! -f "${inputFileName}" ]
then
echo "${inputFileName}: does not exist"
exit 1
fi
}
checkUsage
output=`${CURL_CMDLINE} -X DELETE -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${ATLAS_URL}/api/atlas/v2/types/typedefs -d @${inputFileName}`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER}
else
echo "failed with error code: ${ret}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Get all typedefs
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
outputFileName=$1
function checkUsage() {
if [ "${outputFileName}" == "" ]
then
outputFileName=`getDataFilePath "typedefs.json"`
fi
}
checkUsage
output=`${CURL_CMDLINE} -X GET -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${ATLAS_URL}/api/atlas/v2/types/typedefs`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER} | tee ${outputFileName}
echo "saved to ${outputFileName}"
else
echo "failed with error code: ${ret}"
fi
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Update typedefs
#
realScriptDir=$(cd "$(dirname "$0")"; pwd)
source ${realScriptDir}/env_atlas.sh
source ./env_atlas.sh
inputFileName=$1
function checkUsage() {
if [ "${inputFileName}" == "" ]
then
echo "Usage: $0 input-file"
exit 1
fi
if [ ! -f "${inputFileName}" ]
then
echo "${inputFileName}: does not exist"
exit 1
fi
}
checkUsage
output=`${CURL_CMDLINE} -X PUT -u ${ATLAS_USER}:${ATLAS_PASS} -H "Accept: application/json" -H "Content-Type: application/json" ${ATLAS_URL}/api/atlas/v2/types/typedefs -d @${inputFileName}`
ret=$?
if [ $ret == 0 ]
then
echo ${output} | ${JSON_FORMATTER}
else
echo "failed with error code: ${ret}"
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment