Acme-Globus
view release on metacpan or search on metacpan
lib/Acme/Globus.pm view on Meta::CPAN
Stubs
=cut
sub ls {
my ( $self, $file_path ) = @_ ;
my $command = qq{ls $file_path} ;
my $result
= _globus_action( $command, $self->{username}, $self->{key_path} ) ;
my @result = split m{\r?\n}, $result ;
return wantarray ? @result : \@result ;
}
sub mkdir { }
sub rename { }
=head2 ENDPOINT MANAGEMENT
=head3 B<acl_add>
lib/Acme/Globus.pm view on Meta::CPAN
sub acl_add {
my ( $self, $endpoint, $email, $rw ) = @_ ;
my $readwrite = 'rw' ;
$readwrite = 'r' unless $rw ;
my $command
= qq{acl-add $endpoint --identityusername=${email} --perm $readwrite }
;
my $result
= _globus_action( $command, $self->{username}, $self->{key_path} ) ;
my ($id) = reverse grep {m{\w}} split m{\s}, $result ;
return $id ;
}
sub acl_list {
my ( $self, $endpoint ) = @_ ;
my $command = qq{acl-list $endpoint} ;
my $result
= _globus_action( $command, $self->{username}, $self->{key_path} ) ;
my $slist = decode_json $result ;
my @list = grep { $_->{permissions} ne 'rw' } @$slist ;
lib/Acme/Globus.pm view on Meta::CPAN
# my ( $self, $endpoint ) = @_ ;
# my $command ;
# if ($endpoint) {
# $command = qq{endpoint-list $endpoint } ;
# }
# else {
# $command = qq{endpoint-list} ;
# }
# my $result
# = _globus_action( $command, $self->{username}, $self->{key_path} ) ;
# my @result = map { ( split m{\s}, $_ )[0] } split "\n", $result ;
# return wantarray ? @result : \@result ;
# }
#lists all my endpoint
sub endpoint_list {
my ($self) = @_ ;
my $command = 'endpoint-search --scope=my-endpoints' ;
my $result
= _globus_action( $command, $self->{username}, $self->{key_path} ) ;
my @result = map { s{\s}{}g ; $_ }
map { ( reverse split m{:} )[0] }
grep {m{Legacy}}
split m{\n}, $result ;
return wantarray ? @result : \@result ;
}
sub endpoint_search {
my ( $self, $search ) = @_ ;
return {} unless $search ;
my $command = qq{endpoint-search $search --scope=my-endpoints} ;
my $result
= _globus_action( $command, $self->{username}, $self->{key_path} ) ;
my %result = map {
chomp ;
my ( $k, $v ) = split m{\s*:\s}, $_ ;
$k => $v
}
split m{\n}, $result ;
return wantarray ? %result : \%result ;
}
sub list_my_endpoints {
my ($self) = @_ ;
my $command = 'endpoint-search --scope=my-endpoints' ;
my $result
= _globus_action( $command, $self->{username}, $self->{key_path} ) ;
my %result = map {
my $hash ;
%$hash = map {
my ( $k, $v ) = split m{\s*:\s*} ;
$k =~ s{\s+}{_}gmx ;
$k = lc $k ;
$k => $v
}
split m{\n} ;
my $id
= $hash->{display_name} ne 'n/a'
? $hash->{display_name}
: $hash->{legacy_name} ;
$id => $hash ;
}
split m{\n\n}, $result ;
return wantarray ? %result : \%result ;
}
sub search_my_endpoints {
my ( $self, $search ) = @_ ;
my %result ;
my $command = qq{endpoint-search $search --scope=my-endpoints} ;
my $result
= _globus_action( $command, $self->{username}, $self->{key_path} ) ;
%result = map {
my $hash ;
%$hash = map {
my ( $k, $v ) = split m{\s*:\s*} ;
$k =~ s{\s+}{_}gmx ;
$k = lc $k ;
$k => $v
}
split m{\n} ;
my $id
= $hash->{display_name} ne 'n/a'
? $hash->{display_name}
: $hash->{legacy_name} ;
$id => $hash ;
}
split m{\n\n}, $result ;
return wantarray ? %result : \%result ;
}
sub endpoint_remove {
my ( $self, $endpoint ) = @_ ;
my $command = qq{endpoint-remove $endpoint} ;
my $result
= _globus_action( $command, $self->{username}, $self->{key_path} ) ;
return $result ;
}
# Sucks. Use endpoint_search instead
sub endpoint_details {
my ( $self, $endpoint ) = @_ ;
my $command = qq{endpoint-details $endpoint} ;
my $result
= _globus_action( $command, $self->{username}, $self->{key_path} ) ;
my %result = map {
chomp ;
my ( $key, $value ) = split m{\s*:\s*}, $_ ;
$key => $value
} split m{\n}, $result ;
return wantarray ? %result : \%result ;
}
=head3 B<endpoint_activate>
=head3 B<endpoint_add>
=head3 B<endpoint_deactivate>
lib/Acme/Globus.pm view on Meta::CPAN
Otherwise stubs
=cut
sub profile {
my ($self) = @_ ;
my $command = qq{profile} ;
my $result
= _globus_action( $command, $self->{username}, $self->{key_path} ) ;
my %output
= map { my ( $k, $v ) = split m{:\s?}, $_ ; $k => $v } split m{\n},
$result ;
return wantarray ? %output : \%output ;
}
sub help { }
sub history { }
sub man { }
sub versions { }
sub _globus_action {
( run in 0.682 second using v1.01-cache-2.11-cpan-e1769b4cff6 )