Artifactory-Client

 view release on metacpan or  search on metacpan

lib/Artifactory/Client.pm  view on Meta::CPAN

        headers => HTTP::Headers->new( %{$header} ),
        ( $file ? ( fh => Path::Tiny::path($file)->openr_raw() ) : () ),
    );
    return $self->request($req);
}

=head2 deploy_artifact_by_checksum( path => $path, properties => { key => [ values ] }, file => $file, sha1 => $sha1 )

Takes path, properties, filename and sha1 then deploys the file.  Note that properties are a hashref with key-arrayref
pairs, such as:

    $prop = { key1 => ['a'], key2 => ['a', 'b'] }

=cut

sub deploy_artifact_by_checksum {
    my ( $self, %args ) = @_;

    my $sha1   = $args{sha1};
    my $header = {
        'X-Checksum-Deploy' => 'true',
        'X-Checksum-Sha1'   => $sha1,
    };
    $args{header} = $header;
    return $self->deploy_artifact(%args);
}

=head2 deploy_artifacts_from_archive( path => $path, file => $file )

Path is the path on Artifactory, file is path to local archive.  Will deploy $file to $path.

=cut

sub deploy_artifacts_from_archive {
    my ( $self, %args ) = @_;

    my $header = { 'X-Explode-Archive' => 'true', };
    $args{header} = $header;
    return $self->deploy_artifact(%args);
}

=head2 push_a_set_of_artifacts_to_bintray( descriptor => 'foo', gpgPassphrase => 'top_secret', gpgSign => 'true' )

Push a set of artifacts to Bintray as a version.  Uses a descriptor file (that must have 'bintray-info' in it's filename
and a .json extension) that was deployed to artifactory, the call accepts the full path to the descriptor as a
parameter.

=cut

sub push_a_set_of_artifacts_to_bintray {
    my ( $self, %args ) = @_;

    my $url = $self->_api_url() . "/bintray/push";
    my $params = $self->_stringify_hash( '&', %args );
    $url .= "?" . $params if ($params);
    return $self->post($url);
}

=head2 push_docker_tag_to_bintray( dockerImage => 'jfrog/ubuntu:latest', async => 'true', ... )

Push Docker tag to Bintray.  Calculation can be synchronous (the default) or asynchronous.  You will need to enter your
Bintray credentials, for more details, please refer to Entering your Bintray credentials.

=cut

sub push_docker_tag_to_bintray {
    my ( $self, %args ) = @_;

    my $url = $self->_api_url() . '/bintray/docker/push/' . $self->repository();
    return $self->post(
        $url,
        "Content-Type" => 'application/json',
        Content        => $self->_json->encode( \%args )
    );
}

=head2 distribute_artifact( publish => 'true', async => 'false' )

Deploys artifacts from Artifactory to Bintray, and creates an entry in the corresponding Artifactory distribution
repository specified

=cut

sub distribute_artifact {
    my ( $self, %args ) = @_;

    my $url = $self->_api_url() . '/distribute';
    return $self->post(
        $url,
        "Content-Type" => 'application/json',
        Content        => $self->_json->encode( \%args )
    );
}

=head2 file_compliance_info( $path )

Retrieves file compliance info of a given path.

=cut

sub file_compliance_info {
    my ( $self, $path ) = @_;
    $path = $self->_merge_repo_and_path($path);
    my $url = $self->_api_url() . "/compliance/$path";
    return $self->get($url);
}

=head2 delete_item( $path )

Delete $path on artifactory.

=cut

sub delete_item {
    my ( $self, $path ) = @_;
    $path = $self->_merge_repo_and_path($path);
    my $url = $self->_art_url() . "/$path";
    return $self->delete($url);
}

=head2 copy_item( from => $from, to => $to, dry => 1, suppressLayouts => 0/1, failFast => 0/1 )

lib/Artifactory/Client.pm  view on Meta::CPAN

    my $repository = $args{repository} || $self->repository();
    return $self->_handle_repository_reindex( "/yum/$repository", %args );
}

=head2 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

=cut

sub calculate_nuget_repository_metadata {
    my ( $self, %args ) = @_;
    my $repository = $args{repository} || $self->repository();
    return $self->_handle_repository_reindex("/nuget/$repository/reindex");
}

=head2 calculate_npm_repository_metadata

Recalculates the npm search index for this repository (local/virtual). Please see the Npm integration documentation for
more details.

=cut

sub calculate_npm_repository_metadata {
    my ( $self, %args ) = @_;
    my $repository = $args{repository} || $self->repository();
    return $self->_handle_repository_reindex("/npm/$repository/reindex");
}

=head2 calculate_maven_index( repos => [ 'repo1', 'repo2' ], force => 0/1 )

Calculates/caches a Maven index for the specified repositories

=cut

sub calculate_maven_index {
    my ( $self, %args ) = @_;

    my $url = $self->_api_url() . "/maven?";
    $url .= $self->_stringify_hash( '&', %args );
    return $self->post($url);
}

=head2 calculate_maven_metadata( $path )

Calculates Maven metadata on the specified path (local repositories only)

=cut

sub calculate_maven_metadata {
    my ( $self, $path ) = @_;
    $path = $self->_merge_repo_and_path($path);
    my $url = $self->_api_url() . "/maven/calculateMetadata/$path";
    return $self->post($url);
}

=head2 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.

=cut

sub calculate_debian_repository_metadata {
    my ( $self, %args ) = @_;
    my $repository = $args{repository} || $self->repository();
    return $self->_handle_repository_reindex( "/deb/reindex/$repository", %args );
}

=head2 calculate_cached_remote_debian_repository_coordinates( 'repokey' )

Calculates/recalculates the Debian packages coordinates

=cut

sub calculate_cached_remote_debian_repository_coordinates {
    my ( $self, $repo_key ) = @_;
    my $repository = $repo_key || $self->repository();
    my $url = $self->_api_url() . "/deb/indexCached/$repository";
    return $self->post($url);
}

=head2 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).

=cut

sub calculate_opkg_repository_metadata {
    my ( $self, %args ) = @_;
    my $repository = $args{repository} || $self->repository();
    return $self->_handle_repository_reindex( "/opkg/reindex/$repository", %args );
}

=head2 calculate_bower_index

Recalculates the index for a Bower repository.

=cut

sub calculate_bower_index {
    my ( $self, %args ) = @_;
    my $repository = $args{repository} || $self->repository();
    return $self->_handle_repository_reindex("/bower/$repository/reindex");
}

=head2 calculate_helm_chart_index

Calculates Helm chart index on the specified path (local repositories only).

=cut

sub calculate_helm_chart_index {
    my ( $self, %args ) = @_;
    my $repository = $args{repository} || $self->repository();
    return $self->_handle_repository_reindex("/helm/$repository/reindex");
}

=head2 calculate_cran_repository_metadata



( run in 0.601 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )