3 Arvados -- client library for Arvados services
8 $arv = Arvados->new(apiHost => 'arvados.local');
10 my $instances = $arv->{'pipeline_instances'}->{'list'}->execute();
11 print "UUID is ", $instances->{'items'}->[0]->{'uuid'}, "\n";
13 $uuid = 'eiv0u-arx5y-2c5ovx43zw90gvh';
14 $instance = $arv->{'pipeline_instances'}->{'get'}->execute('uuid' => $uuid);
15 print "ETag is ", $instance->{'etag'}, "\n";
17 $instance->{'active'} = 1;
18 $instance->{'name'} = '';
20 print "ETag is ", $instance->{'etag'}, "\n";
26 my $whc = Arvados->new( %OPTIONS );
28 Set up a client and retrieve the schema from the server.
36 Hostname of API discovery service. Default: C<ARVADOS_API_HOST>
37 environment variable, or C<arvados>
39 =item apiProtocolScheme
41 Protocol scheme. Default: C<ARVADOS_API_PROTOCOL_SCHEME> environment
46 Authorization token. Default: C<ARVADOS_API_TOKEN> environment variable
65 use Arvados::ResourceAccessor;
66 use Arvados::ResourceMethod;
67 use Arvados::ResourceProxy;
68 use Arvados::ResourceProxyList;
71 $Arvados::VERSION = 0.1;
78 bless ($self, $class);
79 return $self->build(@_);
86 $config = load_config_file("$ENV{HOME}/.config/arvados/settings.conf");
88 $self->{'authToken'} ||=
89 $ENV{ARVADOS_API_TOKEN} || $config->{ARVADOS_API_TOKEN};
91 $self->{'apiHost'} ||=
92 $ENV{ARVADOS_API_HOST} || $config->{ARVADOS_API_HOST};
94 $self->{'apiProtocolScheme'} ||=
95 $ENV{ARVADOS_API_PROTOCOL_SCHEME} ||
96 $config->{ARVADOS_API_PROTOCOL_SCHEME};
98 $self->{'ua'} = new Arvados::Request;
100 my $host = $self->{'apiHost'} || 'arvados';
101 my $service = $self->{'apiService'} || 'arvados';
102 my $version = $self->{'apiVersion'} || 'v1';
103 my $scheme = $self->{'apiProtocolScheme'} || 'https';
104 my $uri = "$scheme://$host/discovery/v1/apis/$service/$version/rest";
105 my $r = $self->new_request;
107 $r->set_method("GET");
108 $r->process_request();
110 my ($status_number, $status_phrase) = $r->get_status();
111 $data = $r->get_body() if $status_number == 200;
112 $headers = $r->get_headers();
114 my $doc = $self->{'discoveryDocument'} = JSON::decode_json($data);
115 print STDERR Dumper $doc if $ENV{'DEBUG_ARVADOS_API_DISCOVERY'};
117 while (($k, $v) = each %{$doc->{'resources'}}) {
118 $self->{$k} = Arvados::ResourceAccessor->new($self, $k);
121 croak "No discovery doc at $uri - $status_number $status_phrase";
129 local $ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'};
130 if ($opts{'noVerifyHostname'} || ($host =~ /\.local$/)) {
131 $ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0;
133 Arvados::Request->new();
136 sub load_config_file ($)
138 my $config_file = shift;
141 if (open (CONF, $config_file)) {
143 next if /^\s*#/ || /^\s*$/; # skip comments and blank lines
145 my ($key, $val) = split /\s*=\s*/, $_, 2;
146 $config{$key} = $val;