NAME

Podman::Client - API client.

SYNOPSIS

# Connect to service
my $Client = Podman::Client->new(
    ConnectionURI => 'http+unix:///run/user/1000/podman/podman.sock',
    Timeout       => 1800,
);

# Send GET request
my $Response = $Client->Get(
    'version',
    Parameters => {},
    Headers    => {},
);

DESCRIPTION

Podman::Client is a HTTP client (user agent) based on Mojo::UserAgent with the needed support to connect to and query the http://podman.io API.

ATTRIBUTES

ConnectionURI

my $Client = Podman::Client->new( ConnectionURI => 'https://127.0.0.1:1234' );

URI to http://podman.io API service, defaults to user UNIX domain socket, e.g. http+unix://run/user/1000/podman/podman.sock

Timeout

my $Client = Podman::Client->new( Timeout => 1800 );

Maximum amount of time in seconds a connection can be inactive before getting closed, defaults to 3600s. Setting the value to 0 will allow connections to be inactive indefinitely.

METHODS

Podman::Client provides the valid HTTP requests to query the Podman::Client API. All methods take a relative endpoint path and optional header parameters and path parameters. if the response has a HTTP code unequal 2xx a Podman::Exception is raised.

Get

my $Response = $Client->Get('version');

Perform GET request and return resulting content (hash, array or binary data).

Delete

my $Response = $Client->Delete('images/docker.io/library/hello-world');

Perform DELETE request and return resulting content (hash, array).

Post

my $Response = $Client->Post(
    'build',
    Data       => $FieHandle,
    Parameters => {
        'file' => 'Dockerfile',
        't'    => 'localhost/goodbye',
    },
    Headers => {
        'Content-Type' => 'application/x-tar'
    },
);

Perform POST request and return resulting content (hash, array), takes additional optional request data (hash, array or filehandle).

AUTHORS

Tobias Schäfer, <tschaefer@blackox.org>

COPYRIGHT AND LICENSE

Copyright (C) 2022-2022, Tobias Schäfer.

This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.