NAME
Juju::Environment - Exposed juju api environment
VERSION
version 1.7
SYNOPSIS
use Juju;
my $juju = Juju->new(endpoint => 'wss://localhost:17070', password => 's3cr3t');
ATTRIBUTES
endpoint
Websocket address
username
Juju admin user, this is a tag and should not need changing from the default.
Note This will be changing once multiple user support is released.
password
Password of juju administrator, found in your environments configuration under password
is_authenticated
Stores if user has authenticated with juju api server
Jobs
Supported juju jobs
METHODS
_prepare_constraints
Makes sure cpu-cores, cpu-power, mem are integers
Params
constraints
hash of service constraints
login
Login to juju, will die on a failed login attempt.
reconnect
Reconnects to API server in case of timeout, this also resets the RequestId.
environment_info
Return Juju Environment information
environment_uuid
Environment UUID from client connection
environment_unset
Unset Environment settings
Params
items
find_tools
Returns list containing all tools matching specified parameters
Params
major_verison
major version int
minor_verison
minor version int
series
Distribution series (eg, trusty)
arch
architecture
agent_version
Returns version of api server
abort_current_upgrade
Aborts and archives the current upgrade synchronization record, if any.
status
Returns juju environment status
client_api_host_ports
Returns network hostports for each api server
get_watcher
Returns watcher
get_watched_tasks
List of all watches for Id
Params
watcher_id
add_charm
Add charm
Params
charm_url
url of charm
get_charm
Get charm
Params
charm_url
url of charm
get_environment_constraints
Get environment constraints
set_environment_constraints
Set environment constraints
Params
constraints
environment constraints
environment_get
Returns all environment settings
environment_set
Sets the given key-value pairs in the environment.
Params
config
Config parameters
add_machine
Allocate new machine from the iaas provider (i.e. MAAS)
Params
series
OS series (i.e precise)
constraints
machine constraints
machine_spec
specific machine
parent_id
id of parent
container_type
kvm or lxc container type
add_machines
Add multiple machines from iaas provider
Params
machines
List of machines
destroy_environment
Destroys Juju environment
destroy_machines
Destroy machines
Params
machine_ids
List of machines
force
Force destroy
provisioning_script
Not implemented
add_relation
Sets a relation between units
Params
endpoint_a
First unit endpoint
endpoint_b
Second unit endpoint
destroy_relation
Removes relation between endpoints
Params
endpoint_a
First unit endpoint
endpoint_b
Second unit endpoint
deploy
Deploys a charm to service, named parameters are required here:
$juju->deploy(
charm => 'mysql',
service_name => 'mysql',
cb => sub {
my $val = shift;
print Dumper($val) if defined($val->{Error});
}
);
Params
charm
charm to deploy, can be in the format of series/charm if needing to specify a different series
service_name
name of service to set. same name as charm
num_units
(optional) number of service units
config_yaml
(optional) A YAML formatted string of charm options
constraints
(optional) Machine hardware constraints
machine_spec
(optional) Machine specification
More information on deploying can be found by running juju help deploy
.
service_set
Set's configuration parameters for unit
Params
service_name
name of service (ie. blog)
config
hash of config parameters
service_unset
Unsets configuration value for service to restore charm defaults
Params
service_name
name of service
config_keys
config items to unset
service_set_charm
Sets charm url for service
Params
service_name
name of service
charm_url
charm location (ie. cs:precise/wordpress)
force
(optional) for setting charm url, overrides any existing charm url already set.
service_get
Returns information on charm, config, constraints, service keys.
Params
service_name
- name of service
get_config
Get service configuration
Params
service_name
name of service
get_service_constraints
Returns the constraints for the given service.
Params
service_name
Name of service
set_service_constraints
Specifies the constraints for the given service.
Params
service_name
Name of service
constraints
Service constraints
share_environment
Allows the given users access to the environment.
Params
users
List of users to allow access
unshare_environment
Removes the given users access to the environment.
Params
users
List of users to remove access
service_destroy
Destroys a service
Params
service_name
name of service
service_expose
Expose service
Params
service_name
Name of service
service_unexpose
Unexpose service
Params
service_name
Name of service
service_charm_relations
All possible relation names of a service
Params
service_name
Name of service
add_service_units
Adds given number of units to a service
Params
service_name
Name of service
num_units
Number of units to add
add_service_unit
Add unit to specific machine
Params
service_name
Name of service
machine_spec
Machine to add unit to
destroy_service_units
Decreases number of units dedicated to a service
Params
unit_names
List of units to destroy
resolved
Clear errors on unit
Params
unit_name
id of unit (eg, mysql/0)
retry
Boolean to force a retry
run
Run the Commands specified on the machines identified through the ids provided in the machines, services and units slices.
Required parameters Commands, Timeout, and at least one Machine
, Service
, or Unit
.
{
command => "",
timeout => TIMEDURATION
machines => [MACHINE_IDS],
services => [SERVICES_IDS],
units => [UNITS_ID]
}
Requires named parameters
Params
command
command to run
timeout
timeout
machines
(optional) List of machine ids
services
(optional) List of services ids
units
(optional) List of unit ids
cb
(optional) callback
run_on_all_machines
Runs the command on all the machines with the specified timeout.
Params
command
command to run
timeout
timeout
set_annotations
Set annotations on entity, valid types are service
, unit
, machine
, environment
Params
entity
entity_type
annotation
get_annotations
Returns annotations that have been set on the given entity.
Params
entity
entity_type
private_address
Get private address of machine or unit
$self->private_address('1'); # get address of machine 1
$self->private_address('mysql/0'); # get address of first unit of mysql
Params
target
Target machine
public_address
Returns the public address of the specified machine or unit. For a machine, target is an id not a tag.
$self->public_address('1'); # get address of machine 1
$self->public_address('mysql/0'); # get address of first unit of mysql
Params
target
Target machine
service_set_yaml
Sets configuration options on a service given options in YAML format.
Params
service
Service Name
yaml
YAML formatted string of options
AUTHOR
Adam Stokes <adamjs@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2014 by Adam Stokes.
This is free software, licensed under:
The MIT (X11) License
SEE ALSO
Please see those modules/websites for more information related to this module.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.