NAME

Juju::Environment - Exposed juju api environment

VERSION

version 1.3

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

query_cs ($charm)

helper for querying charm store for charm details

_prepare_constraints ($constraints)

Makes sure cpu-cores, cpu-power, mem are integers

constraints - hash of service constraints

Returns - an updated constraint hash with any integers set properly.

login

Login to juju, will die on a failed login attempt.

reconnect

Reconnects to API server in case of timeout

environment_info

Return Juju Environment information

environment_uuid

Environment UUID from client connection

environment_unset ($items)

Environment UUID from client connection

find_tools ($major_version, $minor_version, $series, $arch)

Returns list containing all tools matching specified parameters

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 ($watcher_id)

List of all watches for Id

add_charm ($charm_url)

Add charm

charm_url - url of charm

get_charm ($charm_url)

Get charm

charm_url - url of charm

get_environment_constraints

Get environment constraints

set_environment_constraints ($constraints)

Set environment constraints

constraints - environment constraints

environment_get

Returns all environment settings

environment_set ($config)

config - Config parameters

add_machine ($series, $constraints, $machine_spec, $parent_id, $container_type)

Allocate new machine from the iaas provider (i.e. MAAS)

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 ($machines)

Add multiple machines from iaas provider

machines - List of machines

destroy_environment

Destroys Juju environment

destroy_machines

Destroy machines

provisioning_script

Not implemented

add_relation ($endpoint_a, $endpoint_b)

Sets a relation between units

remove_relation ($endpoint_a, $endpoint_b)

Removes relation between endpoints

deploy ($service_name, $charm_url, $num_units, $config_yaml, $constraints, $machine_spec)

Deploys a charm to service

set_config ($service_name, $config)

Set's configuration parameters for unit

service_name - name of service (ie. blog)

config - hash of config parameters

unset_config ($service_name, $config_keys)

Unsets configuration value for service to restore charm defaults

service_name - name of service

config_keys - hash of config keys to unset

set_charm ($service_name, $charm_url, $force)

Sets charm url for service

service_name - name of service

charm_url - charm location (ie. cs:precise/wordpress)

get_service ($service_name)

Returns information on charm, config, constraints, service keys.

service_name - name of service

Returns - Hash of information on service

get_config ($service_name)

Get service configuration

service_name - name of service

Returns - Hash of service configuration

get_service_constraints ($service_name)

Returns the constraints for the given service.

service_name - Name of service

set_service_constraints ($service_name, $constraints)

service_name - Name of service

constraints - Service constraints

share_environment($users)

Allows the given users access to the environment.

unshare_environment($users)

Removes the given users access to the environment.

service_destroy ($service_name)

Destroys a service

service_name - name of service

service_expose ($service_name)

Expose service

service_name - Name of service

service_unexpose ($service_name)

Unexpose service

service_name - Name of service

service_charm_relations

All possible relation names of a service

add_service_units ($service_name, $num_units)

Adds given number of units to a service

add_service_unit ($service_name, $machine_spec)

Add unit to specific machine

destroy_service_units ($unit_names)

Decreases number of units dedicated to a service

resolved ($unit_name, $retry)

Clear errors on unit

unit_name - id of unit (eg, mysql/0) retry - bool

run

Not implemented yet.

set_annotations

Set annotations on entity, valid types are service, unit, machine, environment

get_annotations ($entity, $entity_type)

Returns annotations that have been set on the given entity.

private_address($target)

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

public_address($target)

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

service_set_yaml ($service, $yaml)

Sets configuration options on a service given options in YAML format.

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.