Giter Club home page Giter Club logo

net-heroku's Introduction

NAME

Net::Heroku - Heroku API

DESCRIPTION

Heroku API

Requires Heroku account - free @ http://heroku.com

USAGE

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.
}

METHODS

new

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.

apps

my @apps = $h->apps;

Returns list of hash references with app information

destroy

my $bool = $h->destroy(name => $name);

Requires app name. Destroys app. Returns true if successful.

create

my $app = $h->create;

Creates a Heroku app. Accepts optional hash list as values, returns hash list. Returns empty list on failure.

add_config

my %config = $h->add_config(name => $name, config_key => $config_value);

Requires app name. Adds config variables passed in hash list. Returns hash config.

config

my %config = $h->config(name => $name);

Requires app name. Returns hash reference of config variables.

add_key

my $bool = $h->add_key(key => ...);

Requires key. Adds ssh public key.

keys

my @keys = $h->keys;

Returns list of keys

remove_key

my $bool = $h->remove_key(key_name => $key_name);

Requires name associated with key. Removes key.

ps

my @processes = $h->ps(name => $name);

Requires app name. Returns list of processes.

run

my $process = $h->run(name => $name, command => $command);

Requires app name and command. Runs command once. Returns hash response.

restart

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.

stop

my $bool = $h->stop(name => $name, ps => $ps, type => $type);

Requires app name. Stop app process.

releases

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.

add_domain

my $bool = $h->add_domain(name => $name, domain => $domain);

Requires app name. Adds domain.

domains

my @domains = $h->domains(name => $name);

Requires app name. Returns list of hashrefs describing assigned domains.

remove_domain

my $bool = $h->remove_domain(name => $name, domain => $domain);

Requires app name associated with domain. Removes domain.

rollback

my $bool = $h->rollback(name => $name, release => $release);

Rolls back to a specified releases

error

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.

TEST

When building/installing, all tests in t/heroku.t will be skipped unless there is a .heroku file present in the build directory. This file should have the following content:

{ package Net::Heroku::Config;
  $username = '<heroku-email/username>';
  $password = '<heroku-password>';
  $api_key  = '<heroku-api-key>';
  $ssh_key  = '<any-public-ssh-key>';
  return 1;
}

SEE ALSO

Mojo::UserAgent, http://mojolicio.us/perldoc/Mojo/UserAgent#DEBUGGING, https://api-docs.heroku.com/

SOURCE

http://github.com/tempire/net-heroku

VERSION

0.11

AUTHOR

Glen Hinkle [email protected]

CONTRIBUTORS

Brian D. Foy

net-heroku's People

Contributors

briandfoy avatar dancingfrog avatar tempire avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.