Net::Heroku - Heroku API
Heroku API
Requires Heroku account - free @ http://heroku.com
my $h = Net::Heroku->new(api_key => api_key);
- or -
my $h = Net::Heroku->new(email => $email, password => $password);
my %res = $h->create;
$h->add_config(name => $res{name}, BUILDPACK_URL => ...);
$h->restart(name => $res{name});
say $_->{name} for $h->apps;
$h->destroy(name => $res{name});
warn 'Error:' . $h->error # Error: App not found.
if not $h->destroy(name => $res{name});
if (!$h->destroy(name => $res{name})) {
my %err = $h->error;
warn "$err{code}, $err{message}"; # 404, App not found.
}
my $h = Net::Heroku->new(api_key => $api_key);
- or -
my $h = Net::Heroku->new(email => $email, password => $password);
Requires api key or user/pass. Returns Net::Heroku object.
my @apps = $h->apps;
Returns list of hash references with app information
my $bool = $h->destroy(name => $name);
Requires app name. Destroys app. Returns true if successful.
my $app = $h->create;
Creates a Heroku app. Accepts optional hash list as values, returns hash list. Returns empty list on failure.
my %config = $h->add_config(name => $name, config_key => $config_value);
Requires app name. Adds config variables passed in hash list. Returns hash config.
my %config = $h->config(name => $name);
Requires app name. Returns hash reference of config variables.
my $bool = $h->add_key(key => ...);
Requires key. Adds ssh public key.
my @keys = $h->keys;
Returns list of keys
my $bool = $h->remove_key(key_name => $key_name);
Requires name associated with key. Removes key.
my @processes = $h->ps(name => $name);
Requires app name. Returns list of processes.
my $process = $h->run(name => $name, command => $command);
Requires app name and command. Runs command once. Returns hash response.
my $bool = $h->restart(name => $name);
my $bool = $h->restart(name => $name, ps => $ps, type => $type);
Requires app name. Restarts app. If ps is supplied, only process is restarted.
my $bool = $h->stop(name => $name, ps => $ps, type => $type);
Requires app name. Stop app process.
my @releases = $h->releases(name => $name);
my %release = $h->releases(name => $name, release => $release);
Requires app name. Returns list of hashrefs. If release name specified, returns hash.
my $bool = $h->add_domain(name => $name, domain => $domain);
Requires app name. Adds domain.
my @domains = $h->domains(name => $name);
Requires app name. Returns list of hashrefs describing assigned domains.
my $bool = $h->remove_domain(name => $name, domain => $domain);
Requires app name associated with domain. Removes domain.
my $bool = $h->rollback(name => $name, release => $release);
Rolls back to a specified releases
my $message = $h->error;
my %err = $h->error;
In scalar context, returns error message from last request
In list context, returns hash with keys: code, message.
If the last request was successful, returns empty list.
Mojo::UserAgent, http://mojolicio.us/perldoc/Mojo/UserAgent#DEBUGGING, https://api-docs.heroku.com/
http://github.com/tempire/net-heroku
0.11
Glen Hinkle tempire@cpan.org
Brian D. Foy