NAME
Net::EtcDv2::DirectoryActions - A object oriented Perl module to create or remove directories with the EtcD version 2 API
VERSION
Version 0.0.3
SYNOPSIS
use feature say;
use Data::Dumper;
use Net::EtcDv2::DirectoryActions;
# create an un-authenticated object for an etcd running on localhost on
# port 2379
my $foo = Net::EtcDv2->new(
'host' => "http://localhost",
'port' => 2379
);
my $stat_struct = $foo->stat('/myDir');
say Dumper $stat_struct;
# outputs the following if '/myDir' exists and is a directory
# $VAR1 = {
# 'type' => 'dir',
# 'uri' => 'http://localhost:2379/myDir',
# 'ace' => '*:POST, GET, OPTIONS, PUT, DELETE',
# 'entryId' => 'cdf818194f3b8d32:23'
# };
#
# The ACE is the access allowed methods and and origin for that path, and
# the 'entryId' is made up from the cluster ID and the etcd item index ID
DESCRIPTION
The Net::EtcDv2::DirectoryActions is an internal module to the Net::EtcDv2 distribution. This module allows code to create, list, and delete directories in an etcd cluster.
METHODS
new
The constructor for the class. For now, we only support HTTP basic authentication.
If the DEBUG environment variable is set, the class will emit debugging output on STDERR.
Parameters:
- class, SCALAR: The class name
- args, HASH: A hash of named parameters:
- host: the hostname of the etcd endpoint
- port: the port number of the etcd endpoint
- user: the username authorized for the etcd environment
- password: the password for the user authorized for the etcd
environment
mkdir
This method creates a directory if the named object does not already exist at that level of the heirarchy. If it already exists, no matter if it is a key or directory, it emits an exception.
Parameters:
- self, SCALAR REF: the object reference
- path, SCALAR: the full path to create
Return type:
- path, SCALAR: the full path that was created
Exceptions:
If the named entry, irregardless of the type, exists, the method will emit error EEXIST
rmdir
This method will delete a directory if the named object exists, and is empty. If any of the following are true, the method emits and appropriate exception:
- If the directory does not exist
- If the directory is not empty unless the recursive flag is passed
- If the object is not a directory
Parameters:
- self, SCALAR REF: the object reference
- path, SCALAR: the full path to delete
- recursive, boolean: whether to recursively delete the directory if it
contains any content
Return type:
- path: SCALAR: the path that was created
Exceptions:
The following exceptions are emitted during error events:
- If the directory does not exist, a 404 exception is thrown
- If the directory is not empty, a 400 exception is thrown
- If the object is not a directory, a 400 exception is thrown
AUTHOR
Gary L. Greene, Jr., <greeneg at tolharadys.net>
BUGS
Please report any bugs or feature requests via this module's GitHub Issues tracker, here: https://github.com/greeneg/Net-EtcDv2.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Net::EtcDv2
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
LICENSE AND COPYRIGHT
This software is Copyright (c) 2020 by Gary L. Greene, Jr.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004