#!/bin/bash
# info: change ip name
# options: ip name
#
# The function for changing dns domain associated with ip.


#----------------------------------------------------------#
#                    Variable&Function                     #
#----------------------------------------------------------#

# Argument defenition
ip=$1
ip_name=$2

# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/main.sh
source $VESTA/func/ip.sh


#----------------------------------------------------------#
#                    Verifications                         #
#----------------------------------------------------------#

check_args '2' "$#" 'ip ip_name'
validate_format 'ip' 'ip_name'
is_ip_valid


#----------------------------------------------------------#
#                       Action                             #
#----------------------------------------------------------#

# Changing ip name
update_ip_value '$NAME' "$ip_name"


#----------------------------------------------------------#
#                       Vesta                              #
#----------------------------------------------------------#

# Logging
log_event "$OK" "$EVENT"

exit
