Debian Codegraph @

script/ecaccess-association-delete

raw
1 #!/usr/bin/perl -w
2 #
3 # ecaccess-association-delete: Delete Association
4 #
5 # [email protected] - 2010-10-15
6
7 use ECMWF::ECaccess;
8 use Getopt::Long;
9 use Pod::Usage;
10
11 my %opt = ( gateway => undef, 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 gateway=s
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 $associationName = $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 association-name specified!\n" ) if not($associationName);
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 # If no Gateway is specified then use the default Gateway
44 $opt{gateway} = $controlChannel->getGatewayName()->result if ( not $opt{gateway} );
45
46 # Delete the association
47 $controlChannel->deleteAssociation( $token, $opt{gateway}, $associationName );
48
49 # Logout
50 END {
51 $ecaccess->releaseToken($token) if ($token);
52 }
53
54 __END__
55
56 =head1 NAME
57
58 ecaccess-association-delete - Delete Association
59
60 =head1 SYNOPSIS
61
62 B<ecaccess-association-delete -version|-help|-manual>
63
64 B<ecaccess-association-delete [-debug] [-gateway> I<name>B<]> I<association-name>
65
66 =head1 DESCRIPTION
67
68 Allow deleting an ECtrans Association. Once deleted the Association can not be retrieved. The History
69 associated with this Association will also be removed from the ECaccess Gateway Database.
70
71 =head1 ARGUMENTS
72
73 =over 8
74
75 =item I<association-name>
76
77 The name of the Association to delete.
78
79 =back
80
81 =head1 OPTIONS
82
83 =over 8
84
85 =item B<-gateway> I<name>
86
87 This is the name of the ECaccess Gateway where the Association is installed.
88 It is by default the Gateway you are connected to. In order to get the name
89 of your current Gateway you can use the B<ecaccess-gateway-name> command. When
90 using the commands at ECMWF the default Gateway is always "boaccess.ecmwf.int".
91
92 =item B<-version>
93
94 Display version number and exits.
95
96 =item B<-help>
97
98 Print a brief help message and exits.
99
100 =item B<-manual>
101
102 Prints the manual page and exits.
103
104 =item B<-retry> I<count>
105
106 Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the
107 initial SSL connection initiated by the command to the ECMWF server. It does not
108 apply to all the subsequent requests made afteward as it is mainly targeting errors
109 that can happen from time to time during the SSL handshake. Default is no retry.
110
111 =item B<-debug>
112
113 Display the SOAP and SSL messages exchanged.
114
115 =back
116
117 =head1 EXAMPLES
118
119 B<ecaccess-association-delete -gateway> I<boaccess.ecmwf.int> I<test>
120
121 Remove the I<test> Association on the I<boaccess.ecmwf.int> Gateway.
122
123 B<ecaccess-association-delete> I<test2>
124
125 Remove the I<test2> Association on the default Gateway.
126
127 =head1 SEE ALSO
128
129 B<ecaccess-association-get>, B<ecaccess-association-list>, B<ecaccess-association-protocol>,
130 B<ecaccess-association-put> and B<ecaccess>.
131
132 =cut