NAME
LogicMonitor::REST::Signature - Generate signatures and authheader info for the Logicmonitor REST API.
VERSION
Version 0.0.1
SYNOPSIS
use LogicMonitor::REST::Signature;
my $company = 'someCompany';
my $accessKey = 'some key';
my $accessID = 'some id';
my $lmsig_helper;
eval {
$lmsig_helper = LogicMonitor::REST::Signature->new(
{
company => $company,
accessID => $accessID,
accessKey => $accessKey,
}
);
} if ( !defined($lmsig_helper) ) {
die( "Failed to initial the module... " . $@ );
}
my $sig;
eval{
$sig=$lmsig_helper->signature({
HTTPverb=>'GET',
path=>/foo/bar',
data=>'foo foo',
});
};
if (!defined($sig)){
die("Failed to generate the signature... ".$@);
}
VARIABLES
This is a basic explanation of various variables used in this doc.
accessID
This is the accessID for the key.
accessKey
This is the API key.
company
This is the company name as shown in the URL.
HTTPverb
This is the HTTP verb for the request in question... so either GET or PUT.
path
This is the path and any variables in the URL.
'https://' . $company . '.logicmonitor.com/santaba/rest' . $path
data
The body of the HTTP request. Can be '', if doing like a GET.
timestamp
Milliseconds since epoc.
use Time::HiRes qw( gettimeofday );
my $timestamp = gettimeofday * 1000;
$timestamp = int($timestamp);
METHODS
new
This requires a hash ref with the following three variables.
accessID
accessKey
Example...
my $lmsig_helper;
eval {
$lmsig_helper = LogicMonitor::REST::Signature->new(
{
accessID => $accessID,
accessKey => $accessKey,
}
);
} if ( !defined($lmsig_helper) ) {
die( "Failed to initial the module... " . $@ );
}
signature
This generates the signature for a request.
This requires variables below.
HTTPverb
timestamp
path
If data is not specified, it is assumed to be ''.
data
Example...
my $sig;
eval{
$sig=$lmsig_helper->signature({
HTTPverb=>'GET',
path=>/foo/bar',
timestamp=>'1234',
});
};
if (!defined($sig)){
die("Failed to generate the signature... ".$@);
}
Generates the auth header. The usage is similiar to signature, but this does not need a timestamp specified.
This requires variables below.
HTTPverb
path
If data is not specified, it is assumed to be ''.
data
Example...
my $auth_header;
eval{
$sig=$lmsig_helper->auth_header({
HTTPverb=>'GET',
path=>/foo/bar',
});
};
if (!defined($sig)){
die("Failed to generate the auth header... ".$@);
}
AUTHOR
Zane C. Bowers-Hadley, <vvelox at vvelox.net>
BUGS
Please report any bugs or feature requests to bug-logicmonitor-rest-signature at rt.cpan.org
, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=LogicMonitor-REST-Signature. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc LogicMonitor::REST::Signature
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
https://rt.cpan.org/NoAuth/Bugs.html?Dist=LogicMonitor-REST-Signature
CPAN Ratings
Search CPAN
GIT Repo
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
This software is Copyright (c) 2020 by Zane C. Bowers-Hadley.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 224:
Unknown directive: =sub