#!/usr/bin/perl

use strict;
use warnings;
use Getopt::Long qw(:config no_ignore_case);
use Perun::Agent;
use Perun::Common qw(printMessage);

sub help {
	return qq{
	Deletes a resource. Resource id is required.
	--------------------------------------
	Available options:
	--resourceId  | -r resource id
	--batch       | -b batch
	--help        | -h prints this help

	};
}

my ($resourceId, $batch);
GetOptions ("help|h" => sub { print help(); exit 0;} ,"batch|b" => \$batch,
"resourceId|r=i" => \$resourceId) || die help();

# Check options
unless (defined($resourceId)) { die "ERROR: resourceId is required \n";}

my $agent = Perun::Agent->new();
my $resourcesAgent = $agent->getResourcesAgent;

$resourcesAgent->deleteResource(resource => $resourceId);

printMessage("Resource Id:$resourceId successfully deleted", $batch);
