Commit 74a40736 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Add a Resolve() method, to resolve urns at the authority.

parent 935f3fd0
......@@ -494,6 +494,54 @@ sub Disable($)
return 0;
}
#
# Resolve something at an authority
#
sub Resolve($$)
{
my ($self, $urn) = @_;
my $manager_version = $self->Version();
return undef
if (!defined($manager_version));
#
# Need a credential to make this call.
#
if (!defined(Genixmlrpc->GetContext())) {
print STDERR "Need an RPC context to generate a self credential\n";
return undef;
}
my $context = Genixmlrpc->GetContext();
my $credential = GeniCredential->GetSelfCredential($self);
if (!defined($credential)) {
print STDERR "Could not create self credential for $self\n";
return undef;
}
my $method_args;
if ($manager_version == 2.0) {
$method_args->{'credentials'} = [$credential->asString()];
$method_args->{'urn'} = $urn;
}
else {
print STDERR "GeniAuthority::Resolve: Unknown version at $self\n";
return undef;
}
my $response =
Genixmlrpc::CallMethod($self->url(), undef, "Resolve", $method_args);
if (!defined($response)) {
print STDERR "*** Internal error Resolving $urn at $self\n";
return undef;
}
if ($response->code() != GENIRESPONSE_SUCCESS) {
print STDERR "Could not resolve $urn at $self Error:";
print STDERR " " . $response->output() . "\n";
return undef;
}
return $response->value();
}
# _Always_ make sure that this 1 is at the end of the file...
1;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment