| 1 |
#!/usr/bin/perl -w |
| 2 |
# |
| 3 |
# ecaccess-event-clear: Clear an ECaccess Event |
| 4 |
# |
| 5 |
# [email protected] - 2010-10-15 |
| 6 |
|
| 7 |
use ECMWF::ECaccess; |
| 8 |
use Getopt::Long; |
| 9 |
use Pod::Usage; |
| 10 |
use Term::ReadKey; |
| 11 |
|
| 12 |
my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); |
| 13 |
|
| 14 |
pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( |
| 15 |
\%opt, |
| 16 |
qw( |
| 17 |
version |
| 18 |
help|? |
| 19 |
manual |
| 20 |
retry=i |
| 21 |
debug |
| 22 |
) |
| 23 |
); |
| 24 |
|
| 25 |
# Display version if requested |
| 26 |
die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); |
| 27 |
|
| 28 |
my $eventid = $ARGV[0]; |
| 29 |
|
| 30 |
pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); |
| 31 |
pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); |
| 32 |
pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No event-id specified!\n" ) if not($eventid); |
| 33 |
|
| 34 |
# Create the ECaccess Controler |
| 35 |
my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); |
| 36 |
|
| 37 |
# Get the Token (using the Certificate in $HOME) |
| 38 |
my $token = $ecaccess->getToken(); |
| 39 |
|
| 40 |
# Get the Control Channel |
| 41 |
my $controlChannel = $ecaccess->getControlChannel(); |
| 42 |
|
| 43 |
# Delete the event |
| 44 |
$controlChannel->clearEvent( $token, $eventid ); |
| 45 |
|
| 46 |
# Logout |
| 47 |
END { |
| 48 |
$ecaccess->releaseToken($token) if ($token); |
| 49 |
} |
| 50 |
|
| 51 |
__END__ |
| 52 |
|
| 53 |
=head1 NAME |
| 54 |
|
| 55 |
ecaccess-event-clear - Clear an ECaccess Event |
| 56 |
|
| 57 |
=head1 SYNOPSIS |
| 58 |
|
| 59 |
B<ecaccess-event-clear -version|-help|-manual> |
| 60 |
|
| 61 |
B<ecaccess-event-clear> I<event-id> |
| 62 |
|
| 63 |
=head1 DESCRIPTION |
| 64 |
|
| 65 |
Allow clearing the event specified by its I<event-id>. Delete all the subscritions to |
| 66 |
this event and reset the sequence number. |
| 67 |
|
| 68 |
=head1 ARGUMENTS |
| 69 |
|
| 70 |
=over 8 |
| 71 |
|
| 72 |
=item I<event-id> |
| 73 |
|
| 74 |
The identifier of the Event to clear. |
| 75 |
|
| 76 |
=back |
| 77 |
|
| 78 |
=head1 OPTIONS |
| 79 |
|
| 80 |
=over 8 |
| 81 |
|
| 82 |
=item B<-version> |
| 83 |
|
| 84 |
Display version number and exits. |
| 85 |
|
| 86 |
=item B<-help> |
| 87 |
|
| 88 |
Print a brief help message and exits. |
| 89 |
|
| 90 |
=item B<-manual> |
| 91 |
|
| 92 |
Prints the manual page and exits. |
| 93 |
|
| 94 |
=item B<-retry> I<count> |
| 95 |
|
| 96 |
Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the |
| 97 |
initial SSL connection initiated by the command to the ECMWF server. It does not |
| 98 |
apply to all the subsequent requests made afteward as it is mainly targeting errors |
| 99 |
that can happen from time to time during the SSL handshake. Default is no retry. |
| 100 |
|
| 101 |
=item B<-debug> |
| 102 |
|
| 103 |
Display the SOAP and SSL messages exchanged. |
| 104 |
|
| 105 |
=back |
| 106 |
|
| 107 |
=head1 EXAMPLES |
| 108 |
|
| 109 |
B<ecaccess-event-clear> I<167> |
| 110 |
|
| 111 |
Clear the event I<167>. |
| 112 |
|
| 113 |
=head1 SEE ALSO |
| 114 |
|
| 115 |
B<ecaccess-event-grant>, B<ecaccess-event-delete>, B<ecaccess-event-send>, B<ecaccess-event-list>, |
| 116 |
B<ecaccess-event-create> and B<ecaccess>. |
| 117 |
|
| 118 |
=cut |