Commit 021f96f9 authored by Roman Lacko's avatar Roman Lacko
Browse files

add GitLab::Runners to implement GitLab Runners API calls

parent 3bdfda2d
...@@ -13,6 +13,7 @@ use GitLab::Groups; ...@@ -13,6 +13,7 @@ use GitLab::Groups;
use GitLab::Members; use GitLab::Members;
use GitLab::Namespaces; use GitLab::Namespaces;
use GitLab::Projects; use GitLab::Projects;
use GitLab::Runners;
use GitLab::Users; use GitLab::Users;
use Try::Tiny; use Try::Tiny;
......
package GitLab::Runners;
use utf8;
use strict;
use warnings;
use vars qw($VERSION);
use GitLab::API;
use Log::Any qw($log);
our $VERSION = v10.4.1;
my $requests = {
user_runners => {
method => "GET",
path => "/runners",
query => [qw(
scope
)],
paginated => 1,
},
runners => {
method => "GET",
path => "/runners/all",
query => [qw(
scope
)],
paginated => 1,
},
runner_by_id => {
method => "GET",
path => "/runners/<rid>",
},
runner_update => {
method => "PUT",
path => "/runners/<rid>",
optional => [qw(
description
active
tag_list
run_untagged
locked
access_level
)],
},
runner_delete => {
method => "DELETE",
path => "/runners/<rid>",
},
runner_jobs => {
method => "GET",
path => "/runners/<rid>/jobs",
query => [qw(
status
)],
paginated => 1,
},
project_runners => {
method => "GET",
path => "/projects/<proj_id>/runners",
paginated => 1,
},
project_runner_enable => {
method => "POST",
path => "/projects<proj_id>/runners",
required => [qw(
rid
)],
paginated => 1,
},
project_runner_disable => {
method => "DELETE",
path => "/projects/<proj_id>/runners/<rid>",
},
};
sub import {
$log->debug("initializing " . __PACKAGE__);
while (my ($name, $tmpl) = each(%$requests)) {
$tmpl->{name} = $name unless exists $tmpl->{name};
GitLab::API->register($tmpl);
}
}
1;
__END__
=head1 NAME
GitLab::Runners - implements runners API calls.
See L<GitLab API -- Projects|http://doc.gitlab.com/ce/api/runners.html> for details and
response formats.
=head1 VERSION
Implements API calls for GitLab CE C<v10.3.3>.
=head1 DESCRIPTION
=head2 Notation
Please see the documentation for the L<GitLab::Users> module.
Note that not all optional arguments are listed.
Please refer to the official documentation for the full list.
=head2 List runners
=over
=item L<user_runners()|https://docs.gitlab.com/ce/api/runners.html#list-owned-runners>
$gitlab->user_runners([:scope]);
Get a list of B<specific> runners available to the user.
The optional C<scope> parameter can be one of C<active>, C<paused>, C<online>.
=item L<runners()|https://docs.gitlab.com/ce/api/runners.html#list-all-runners>
$gitlab->runners([:scope]);
Get a list of all runners in the GitLab instance.
I<This is available only to administrators.>
=item L<runner_by_id()|https://docs.gitlab.com/ce/api/runners.html#get-runner-39-s-details>
$gitlab->runner_by_id(:rid);
Get details of a runner.
=item L<runner_update()|https://docs.gitlab.com/ce/api/runners.html#update-runner-39-s-details>
$gitlab->runner_update(:rid, [:description], [:tag_list], ...);
Update details of a runner.
=item L<runner_delete()|https://docs.gitlab.com/ce/api/runners.html#remove-a-runner>
$gitlab->runner_delete(:rid);
Remove a runner.
=item L<runner_jobs()|https://docs.gitlab.com/ce/api/runners.html#list-runner-39-s-jobs>
$gitlab->runner_jobs(:rid, [:status]);
List jobs that are being processed or were processed by specified Runner..
=item L<project_runners()|https://docs.gitlab.com/ce/api/runners.html#list-project-39-s-runners>
$gitlab->project_runners(:proj_id);
List all runners available to the project.
Shared runners are listed if at least one shared runner is defined
B<and> shared runners usage is enabled in the project's settings.
=item L<project_runner_enable()|https://docs.gitlab.com/ce/api/runners.html#enable-a-runner-in-project>
$gitlab->project_runner_enable(:proj_id, :rid);
Enable an available B<specific> runner in the project.
=item L<project_runner_disable()|https://docs.gitlab.com/ce/api/runners.html#disable-a-runner-from-project>
$gitlab->project_runner_disable(:proj_id, :rid);
Disable a specific runner from the project.
It works only if the project isn't the only project associated with
the specified runner. If so, an error is returned.
Use the L</runner_delete()> call instead.
=head1 AUTHOR
Roman Lacko <L<xlacko1@fi.muni.cz>>
=head1 SEE ALSO
=over
=item L<GitLab>
Wrapper around L<GitLab::API> and other C<GitLab::*> modules.
=back
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment