API-Docker

 view release on metacpan or  search on metacpan

lib/API/Docker/API/Configs.pm  view on Meta::CPAN

Get a config by ID or name. Returns an L<API::Docker::Type::Config> -- the
same class L</list> returns -- with C<< ->id >>, C<< ->spec >>,
C<< ->created_at >>, C<< ->updated_at >> and C<< ->version >> as the daemon
sent them. C<< ->spec->data >> is base64 and is B<not> rewritten;
L<API::Docker::Role::Entity::Config/decoded_data> derives the bytes from it
on demand.

=head2 update

    my $config = $configs->inspect($id);
    my %spec   = %{ $config->Spec };
    delete $spec{Data};                       # already base64 -- see below
    $spec{Labels} = { app => 'web', tier => 'edge' };

    $configs->update($id, $config->version_index, %spec);
    $config->update(%spec);                   # the same call, via the entity

Update a config. Returns nothing on success -- the daemon answers 200 with an
empty body.

C<$version> is mandatory and is the C<Version.Index> from L</inspect>; see
L</"update takes the current version, and it is mandatory"> for why it cannot
be guessed and why the whole spec goes back.
L<API::Docker::Role::Entity::Config/update> fills it in from the entity it
was called on.

A C<Data> passed here is treated like L</create>'s: raw bytes, encoded on the
way out. The C<Data> in a spec from L</inspect> is already base64, so drop
it, or replace it with
L<API::Docker::Role::Entity::Config/decoded_data>, before handing that spec
back -- otherwise it gets encoded twice.

=head2 remove

    $configs->remove($id);

Remove a config by ID or name. The daemon answers 204 with no body, so this
returns nothing; a config that is not there is a 404 and croaks.

=head1 SEE ALSO

=over

=item * L<API::Docker> - Main Docker client

=item * L<API::Docker::Role::Entity::Config> - the convenience methods the
returned objects carry

=item * L<API::Docker::Type::Config> - the fields L</list> and L</inspect>
return

=item * L<API::Docker::API::Secrets> - Secrets, the same shape for values that
must not be readable back

=back

=head1 SUPPORT

=head2 Issues

Please report bugs and feature requests on GitHub at
L<https://github.com/Getty/p5-api-docker/issues>.

=head1 CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

=head1 AUTHOR

Torsten Raudssus <getty@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> L<https://raudssus.de/>.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut



( run in 0.862 second using v1.01-cache-2.11-cpan-364913b4093 )