# # Copyright (c) 2014 NetApp, Inc., All Rights Reserved. # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @pod here package NACL::ServiceAPI::GoodnightMoon; use strict; use warnings; use parent qw(NACL::ServiceAPI); sub new { shift->SUPER::new(language=>'python',@_); } 1; __END__ =head1 NAME NACL::ServiceAPI::GoodnightMoon - Client Side to the GoodnightMoon Service =head1 SYNOPSIS use NACL::ServiceAPI::GoodnightMoon; =head1 DESCRIPTION A C is used to direct the GoodnightMoon Service. =head1 METHODS =head2 new This is the constructor method that finds running C services and gets prepared to talk to them. =over =item Synopsis use NACL::ServiceAPI::GoodnightMoon; my $api = NACL::ServiceAPI::GoodnightMoon->new(); =back =head2 some_api This is a pass through to the 'some_api' functionality in the GoodnightMoon service =over =item Synopsis use NACL::ServiceAPI::GoodnightMoon; my $api = NACL::ServiceAPI::GoodnightMoon->new(); print $api->some_api(request_timeout => -1)."\n"; # or my $req_id = $api->some_api(); print $api->some_api(id => $req_id) ."\n"; # or require NATE::Events;# qw(eventloop_drain); require NATE::Service::Constants;# qw(STATUS_READY STATUS_WAITING); my @req_ids; push(@req_ids, $api->some_api()); push(@req_ids, $api->some_api()); while(@req_ids) # Never Ever wait on one request when others may have already come in { my @temp = @req_ids; NATE::Events::eventloop_drain(); for my $id (@temp) { my $id = shift(@req_ids); my $status = $api->request_status(id=>$id); if($status == &NATE::Service::Constants::STATUS_READY) { print $api->request_get(id => $id) ."\n"; } elsif($status == &NATE::Service::Constants::STATUS_WAITING) { push(@req_ids, $id); # Not ready yet, put it back on the stack to try later } } } =back =head2 other_api This is a pass through to the 'other_api' functionality in the GoodnightMoon service. The C functionality in the service calculates the square of the C option. =over =item Synopsis use NACL::ServiceAPI::GoodnightMoon; my $api = NACL::ServiceAPI::GoodnightMoon->new(); print $api->other_api(number=>5, request_timeout => -1)."\n"; # or my $req_id = $api->other_api(number=>5); print $api->request_get(id => $req_id) ."\n"; # or require NATE::Events;# qw(eventloop_drain); require NATE::Service::Constants;# qw(STATUS_READY STATUS_WAITING); my @req_ids; push(@req_ids, $api->other_api(number=>5)); while(@req_ids) # Never Ever wait on one request when others may have already come in { my @temp = @req_ids; NATE::Events::eventloop_drain(); for my $id (@temp) { my $id = shift(@req_ids); my $status = $api->request_status(id=>$id); if($status == &NATE::Service::Constants::STATUS_READY) { print $api->request_get(id => $id) ."\n"; } elsif($status == &NATE::Service::Constants::STATUS_WAITING) { push(@req_ids, $id); # Not ready yet, put it back on the stack to try later } } } =item Arguments =over =item C<< number => $number >> (Optional) calculate the square of this number and return it. Default: 2 =back =back =head1 SEE ALSO This is a derived class of L>. Please see the documentation for more details =head1 AUTHOR/MAINTAINER NACL Development (dl-nacl-dev@netapp.com) =cut