Debian Codegraph @

script/ecaccess-file-delete

raw
1 #!/usr/bin/perl -w
2 #
3 # ecaccess-file-delete: Remove an ECaccess File
4 #
5 # [email protected] - 2010-10-15
6
7 use ECMWF::ECaccess;
8 use Getopt::Long;
9 use Pod::Usage;
10
11 my %opt = ( force => 0, version => 0, help => 0, manual => 0, retry => 0, debug => 0 );
12
13 pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions(
14 \%opt,
15 qw(
16 force
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 $ecaccessFile = $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 ecaccess-file specified!\n" ) if not($ecaccessFile);
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 file
44 $controlChannel->deleteFile( $token, $ecaccessFile, SOAP::Data->type( boolean => $opt{force} ) );
45
46 # Logout
47 END {
48 $ecaccess->releaseToken($token) if ($token);
49 }
50
51 __END__
52
53 =head1 NAME
54
55 ecaccess-file-delete - Remove an ECaccess File
56
57 =head1 SYNOPSIS
58
59 B<ecaccess-file-delete -version|-help|-manual>
60
61 B<ecaccess-file-delete [-debug] [-force]> I<ecaccess-file>
62
63 =head1 DESCRIPTION
64
65 Remove the I<ecaccess-file>.
66
67 The I<ecaccess-file> is in the form [domain:][/user-id/]path. Please read the "Shell commands -> File Management"
68 section of the "ecaccess" guide for more information on the ECaccess File System.
69
70 =head1 ARGUMENTS
71
72 =over 8
73
74 =item I<ecaccess-file>
75
76 The name of the ECaccess File to delete.
77
78 =back
79
80 =head1 OPTIONS
81
82 =over 8
83
84 =item B<-force>
85
86 Ignore nonexistent files and complete successfully.
87
88 =item B<-version>
89
90 Display version number and exits.
91
92 =item B<-help>
93
94 Print a brief help message and exits.
95
96 =item B<-manual>
97
98 Prints the manual page and exits.
99
100 =item B<-retry> I<count>
101
102 Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the
103 initial SSL connection initiated by the command to the ECMWF server. It does not
104 apply to all the subsequent requests made afteward as it is mainly targeting errors
105 that can happen from time to time during the SSL handshake. Default is no retry.
106
107 =item B<-debug>
108
109 Display the SOAP and SSL messages exchanged.
110
111 =back
112
113 =head1 EXAMPLES
114
115 B<ecaccess-file-delete> I<scratch:bin/a.out>
116
117 Remove the I<a.out> File of the $SCRATCH/bin directory of the authenticated user.
118
119 =head1 SEE ALSO
120
121 B<ecaccess-file-chmod>, B<ecaccess-file-get>, B<ecaccess-file-mget>, B<ecaccess-file-modtime>, B<ecaccess-file-mput>,
122 B<ecaccess-file-rmdir>, B<ecaccess-file-copy>, B<ecaccess-file-dir>, B<ecaccess-file-mdelete>, B<ecaccess-file-mkdir>,
123 B<ecaccess-file-move>, B<ecaccess-file-put>, B<ecaccess-file-size> and B<ecaccess>.
124
125 =cut