Artifactory-Client
view release on metacpan or search on metacpan
[](https://travis-ci.org/satoshi/Artifactory-Client)
# NAME
Artifactory::Client - Perl client for Artifactory REST API
# VERSION
Version 1.8.0
# SYNOPSIS
This is a Perl client for Artifactory REST API:
https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API Every public method provided in this module returns a
HTTP::Response object.
use Artifactory::Client;
my $h = HTTP::Headers->new();
$h->authorization_basic( 'admin', 'password' );
my $ua = LWP::UserAgent->new( default_headers => $h );
my $args = {
artifactory => 'http://artifactory.server.com',
port => 8080,
repository => 'myrepository',
context_root => '/', # Context root for artifactory. Defaults to 'artifactory'.
ua => $ua # Dropping in custom UA with default_headers set. Default is a plain LWP::UserAgent.
};
my $client = Artifactory::Client->new( $args );
my $path = '/foo'; # path on artifactory
# Properties are a hashref of key-arrayref pairs. Note that value must be an arrayref even for a single element.
# This is to conform with Artifactory which treats property values as a list.
my $properties = {
one => ['two'],
baz => ['three'],
};
my $file = '/local/file.xml';
# Name of methods are taken straight from Artifactory REST API documentation. 'Deploy Artifact' would map to
# deploy_artifact method, like below. The caller gets HTTP::Response object back.
my $resp = $client->deploy_artifact( path => $path, properties => $properties, file => $file );
# Custom requests can also be made via usual get / post / put / delete requests.
my $resp = $client->get( 'http://artifactory.server.com/path/to/resource' );
# Repository override for calls that have a repository in the endpoint. The passed-in repository will not persist.
my $resp = $client->calculate_yum_repository_metadata( repository => 'different_repo', async => 1 );
# Dev Env Setup / Running Tests
carton install
# to run unit tests
prove -r t
# GENERIC METHODS
## get( @args )
Invokes GET request on LWP::UserAgent-like object; params are passed through.
## post( @args )
nvokes POST request on LWP::UserAgent-like object; params are passed through.
## put( @args )
Invokes PUT request on LWP::UserAgent-like object; params are passed through.
## delete( @args )
Invokes DELETE request on LWP::UserAgent-like object; params are passed
through.
## request( @args )
Invokes request() on LWP::UserAgent-like object; params are passed through.
# BUILDS
## all\_builds
Retrieves information on all builds from artifactory.
## build\_runs( $build\_name )
Retrieves information of a particular build from artifactory.
## build\_upload( $path\_to\_json )
Upload Build
## build\_info( $build\_name, $build\_number )
Retrieves information of a particular build number.
## builds\_diff( $build\_name, $new\_build\_number, $old\_build\_number )
Retrieves diff of 2 builds
## build\_promotion( $build\_name, $build\_number, $payload )
Promotes a build by POSTing payload
## promote\_docker\_image( targetRepo => "target\_repo", dockerRepository => "dockerRepository", tag => "tag", copy => 'false' )
Removes a repository configuration together with the whole repository content
## calculate\_yum\_repository\_metadata( async => 0/1 )
Calculates/recalculates the YUM metdata for this repository, based on the RPM package currently hosted in the repository
## calculate\_nuget\_repository\_metadata
Recalculates all the NuGet packages for this repository (local/cache/virtual), and re-annotate the NuGet properties for
each NuGet package according to it's internal nuspec file
## calculate\_npm\_repository\_metadata
Recalculates the npm search index for this repository (local/virtual). Please see the Npm integration documentation for
more details.
## calculate\_maven\_index( repos => \[ 'repo1', 'repo2' \], force => 0/1 )
Calculates/caches a Maven index for the specified repositories
## calculate\_maven\_metadata( $path )
Calculates Maven metadata on the specified path (local repositories only)
## calculate\_debian\_repository\_metadata( async => 0/1 )
Calculates/recalculates the Packages and Release metadata for this repository,based on the Debian packages in it.
Calculation can be synchronous (the default) or asynchronous.
## calculate\_cached\_remote\_debian\_repository\_coordinates( 'repokey' )
Calculates/recalculates the Debian packages coordinates
## calculate\_opkg\_repository\_metadata( async => 0/1, writeProps => 1 )
Calculates/recalculates the Packages and Release metadata for this repository,based on the ipk packages in it (in each
feed location).
## calculate\_bower\_index
Recalculates the index for a Bower repository.
## calculate\_helm\_chart\_index
Calculates Helm chart index on the specified path (local repositories only).
## calculate\_cran\_repository\_metadata
Calculates/recalculates the Packages and Release metadata for this repository, based on the CRAN packages in it.
## calculate\_conda\_repository\_metadata
Calculates/recalculates the Conda packages and release metadata for this repository.
# SYSTEM & CONFIGURATION
## system\_info
Get general system information
## verify\_connection( endpoint => 'http://server/foobar', username => 'admin', password => 'password' )
Verifies a two-way connection between Artifactory and another product
## system\_health\_ping
Get a simple status response about the state of Artifactory
## general\_configuration
Get the general configuration (artifactory.config.xml)
## save\_general\_configuration( $file )
Save the general configuration (artifactory.config.xml)
## update\_custom\_url\_base( $url )
Changes the Custom URL base
## license\_information
Retrieve information about the currently installed license
## install\_license( $licensekey )
Install new license key or change the current one
## ha\_license\_information
Retrieve information about the currently installed licenses in an HA cluster
## install\_ha\_cluster\_licenses( \[ { licenseKey => 'foobar' }, { licenseKey => 'barbaz' } \] )
Install a new license key(s) on an HA cluster
## delete\_ha\_cluster\_license( 'licenseHash1', 'licenseHash2' )
Deletes a license key from an HA cluster
## version\_and\_addons\_information
Retrieve information about the current Artifactory version, revision, and currently installed Add-ons
## get\_reverse\_proxy\_configuration
Retrieves the reverse proxy configuration
## update\_reverse\_proxy\_configuration(%data)
Updates the reverse proxy configuration
## get\_reverse\_proxy\_snippet
Gets the reverse proxy configuration snippet in text format
## start\_sha256\_migration\_task( "batchThreshold" => 10, etc etc )
Starts the SHA-256 migration process.
## stop\_sha256\_migration\_task( "sleepIntervalMillis" => 5000, etc etc )
Stops the SHA-256 migration process
# PLUGINS
## execute\_plugin\_code( $execution\_name, $params, $async )
Executes a named execution closure found in the executions section of a user plugin
## retrieve\_all\_available\_plugin\_info
Retrieves all available user plugin information (subject to the permissions of the provided credentials)
## retrieve\_plugin\_info\_of\_a\_certain\_type( $type )
Retrieves all available user plugin information (subject to the permissions of the provided credentials) of the
specified type
## retrieve\_build\_staging\_strategy( strategyName => 'strategy1', buildName => 'build1', %args )
Retrieves a build staging strategy defined by a user plugin
## execute\_build\_promotion( promotionName => 'promotion1', buildName => 'build1', buildNumber => 3, %args )
Executes a named promotion closure found in the promotions section of a user plugin
## reload\_plugins
Reloads user plugins if there are modifications since the last user plugins reload. Works regardless of the automatic
user plugins refresh interval
# IMPORT & EXPORT
## import\_repository\_content( path => 'foobar', repo => 'repo', metadata => 1, verbose => 0 )
Import one or more repositories
## import\_system\_settings\_example
Returned default Import Settings JSON
## full\_system\_import( importPath => '/import/path', includeMetadata => 'false' etc )
Import full system from a server local Artifactory export directory
## export\_system\_settings\_example
Returned default Export Settings JSON
## export\_system( exportPath => '/export/path', includeMetadata => 'true' etc )
Export full system to a server local directory
## ignore\_xray\_alert( $path )
Sets an alert to be ignored until next time the repository hosting the artifact about which the alert was issued, is scanned. Note that this endpoint does not
affect artifacts that are blocked because they have not been scanned at all.
## allow\_download\_of\_blocked\_artifacts( 'true'|'false' )
When a repository is configured to block downloads of artifacts, you may override that configuration (and allow download of blocked artifacts). Note that this
setting cannot override the blocking of unscanned artifacts.
## allow\_download\_when\_xray\_is\_unavailable( 'true'|'false' )
You may configure Artifactory to block downloads of artifacts when the connected Xray instance is unavailable. This endpoint lets you override that
configuration (and allow download of artifacts).
## create\_bundle( %hash of data structure )
Create a new support bundle
## list\_bundles
Lists previously created bundle currently stored in the system
## get\_bundle\_metadata( $name )
Downloads a previously created bundle currently stored in the system
## get\_bundle( $name )
Downloads a previously created bundle currently stored in the system
## delete\_bundle( $name )
Deletes a previously created bundle from the system.
# AUTHOR
Satoshi Yagi, `<satoshi.yagi at yahoo.com>`
# BUGS
Please report any bugs or feature requests to `bug-artifactory-client at
rt.cpan.org`, or through the web interface at
[http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Artifactory-Client](http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Artifactory-Client). 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 Artifactory::Client
You can also look for information at:
- RT: CPAN's request tracker (report bugs here)
[http://rt.cpan.org/NoAuth/Bugs.html?Dist=Artifactory-Client](http://rt.cpan.org/NoAuth/Bugs.html?Dist=Artifactory-Client)
- AnnoCPAN: Annotated CPAN documentation
[http://annocpan.org/dist/Artifactory-Client](http://annocpan.org/dist/Artifactory-Client)
- CPAN Ratings
[http://cpanratings.perl.org/d/Artifactory-Client](http://cpanratings.perl.org/d/Artifactory-Client)
- Search CPAN
[http://search.cpan.org/dist/Artifactory-Client/](http://search.cpan.org/dist/Artifactory-Client/)
# ACKNOWLEDGEMENTS
( run in 2.989 seconds using v1.01-cache-2.11-cpan-5735350b133 )