User:AnomieBOT/source/AnomieBOT/API/Toolforge.pm/doc
NAME
editAnomieBOT::API::Toolforge - AnomieBOT Toolforge API access
SYNOPSIS
edituse AnomieBOT::API::Toolforge; my $toolforge = AnomieBOT::API::Toolforge->new( toolname => "my-tool" ); my $jobs = $toolforge->jobs();
DESCRIPTION
editAnomieBOT::API::Toolforge
provides some methods to interact with the Toolforge API internal endpoint.
METHODS
editCONSTRUCTOR
edit- AnomieBOT::API::Toolforge->new( %options )
- Creates a new AnomieBOT::API::Toolforge object. Available options are:
- toolname
- Name of the tool.
- crtfile
- Certificate file to use rather than
$HOME/.toolskube/client.crt
. - keyfile
- Key file to use rather than
$HOME/.toolskube/client.key
.
ATTRIBUTES
edit- $toolforge->toolname()
- $toolforge->toolname( $newname )
- Get or set the tool name. Returns the old name.
GENERIC ACCESS
edit- $toolforge->get( $endpoint )
- $toolforge->get( $endpoint, $header_name => $value, ... )
- $toolforge->post( $endpoint, \%fields )
- $toolforge->post( $endpoint, \%fields, $field_name => $value, ... )
- $toolforge->post( $endpoint, $field_name => $value, Content => \%fields )
- $toolforge->post( $endpoint, $field_name => $value, Content => $content )
- $toolforge->delete( $endpoint )
- $toolforge->delete( $endpoint, $header_name => $value, ... )
- $toolforge->patch( $endpoint, \%fields )
- $toolforge->patch( $endpoint, \%fields, $field_name => $value, ... )
- $toolforge->patch( $endpoint, $field_name => $value, Content => \%fields )
- $toolforge->patch( $endpoint, $field_name => $value, Content => $content )
- $toolforge->put( $endpoint, \%fields )
- $toolforge->put( $endpoint, \%fields, $field_name => $value, ... )
- $toolforge->put( $endpoint, $field_name => $value, Content => \%fields )
- $toolforge->put( $endpoint, $field_name => $value, Content => $content )
- Make a request to an API endpoint.
- Then
$endpoint
is the API endpoint with leading slash, e.g./jobs/v1/healthz
. - Any additional options (i.e. form data or HTTP headers) are passed on to the corresponding methods of
LWP::UserAgent
. See documentation there for details. - All return an AnomieBOT::API::Toolforge::Reponse object, which is a subclass of HTTP::Response with an additional
json_content
method that JSON-decodes thedecoded_content
.
ENDPOINT WRAPPERS
edit- $toolforge->pods()
- Get running pods from Kubernetes.
- Pending https://phabricator.wikimedia.org/T321919#11126898.
- $toolforge->jobs()
- Wrapper for GET
/jobs/v1/tool/{toolname}/jobs
. - $toolforge->submit_job( %data )
- Wrapper for POST
/jobs/v1/tool/{toolname}/jobs
.