Add host refresh
This commit is contained in:
57
rsc_host_refresh.sh
Executable file
57
rsc_host_refresh.sh
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Example RSC API call script
|
||||
# v0.1 - James Pattinson - September 2025
|
||||
#
|
||||
# Perfoms a host refresh in RSC
|
||||
#
|
||||
# usage: rsc_host_refresh.sh <targethost>
|
||||
#
|
||||
# Options:
|
||||
# <targethost> : Host to perform refresh job
|
||||
|
||||
usage() { echo "Usage: $0 <host>" 1>&2; exit 1; }
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
MYDIR="$(dirname "$(realpath "$0")")"
|
||||
|
||||
source $MYDIR/oracle_funcs.sh
|
||||
source $MYDIR/rsc_ops.sh
|
||||
|
||||
RBK_HOST=$1
|
||||
|
||||
rsc_get_host_id
|
||||
|
||||
echo "Host ID: $targetHostId"
|
||||
|
||||
gql_refreshHost='mutation RefreshHost($input: RefreshHostInput!) {
|
||||
refreshHost(input: $input) {
|
||||
output {
|
||||
hostSummary {
|
||||
name
|
||||
operatingSystemType
|
||||
status
|
||||
}
|
||||
agentId
|
||||
}
|
||||
}
|
||||
}'
|
||||
|
||||
variables="{
|
||||
\"input\": {
|
||||
\"id\": \"$targetHostId\"
|
||||
}
|
||||
}"
|
||||
|
||||
gqlQuery="$(echo $gql_refreshHost)"
|
||||
gqlVars="$(echo $variables)"
|
||||
|
||||
echo "Refreshing host $RBK_HOST (ID: $targetHostId)"
|
||||
|
||||
rsc_gql_query
|
||||
|
||||
echo "Response:"
|
||||
cat /tmp/rbkresponse.$$ | jq
|
||||
Reference in New Issue
Block a user