API-Docker
view release on metacpan or search on metacpan
lib/API/Docker/API/Secrets.pm view on Meta::CPAN
=back
=head2 create
my $created = $secrets->create(
Name => 'my-secret',
Data => "hunter2\n",
Labels => { env => 'prod' },
);
Create a secret. Returns the daemon's response, a HashRef carrying C<ID> --
not an L<API::Docker::Type::Secret>, because C<ID> is all the daemon answers
with
and an entity built from it would carry no C<Spec> and no C<Version>. Call
L</inspect> on that C<ID> for the object.
Options:
=over
=item * C<Name> - Required. The secret's name.
=item * C<Data> - Required. The secret's value as B<raw bytes>; this method
base64-encodes it. See L</"Data is raw bytes; this class does the base64">.
=item * C<Labels> - HashRef of labels.
=item * C<Driver> - HashRef naming an external secret driver, C<< { Name =>
..., Options => {...} } >>.
=item * C<Templating> - HashRef naming a templating driver, same shape.
=back
=head2 inspect
my $secret = $secrets->inspect($id);
my $index = $secret->version_index; # what update needs
Get a secret's metadata by ID or name. Returns an
L<API::Docker::Type::Secret> -- the same class L</list> returns -- with
C<< ->id >>, C<< ->spec >>, C<< ->created_at >>, C<< ->updated_at >> and
C<< ->version >>. Never the value -- see
L<API::Docker::Role::Entity::Secret/"There is no accessor for the value">.
=head2 update
my $secret = $secrets->inspect($id);
my %spec = %{ $secret->spec->TO_JSON };
$spec{Labels} = { env => 'staging' };
$secrets->update($id, $secret->version_index, %spec);
$secret->update(%spec); # the same call, via the entity
Update a secret. 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::Secret/update> fills it in from the entity it
was called on. Podman does not implement this
endpoint and answers 501.
=head2 remove
$secrets->remove($id);
Remove a secret by ID or name. The daemon answers 204 with no body, so this
returns nothing; a secret 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::Secret> - the convenience methods the
returned objects carry
=item * L<API::Docker::Type::Secret> - the fields L</list> and L</inspect>
return
=item * L<API::Docker::API::Configs> - Configs, the same shape without the
secrecy
=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 1.384 second using v1.01-cache-2.11-cpan-54e63673c56 )