Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 581 lines (302 sloc) 11.5 KB
#!/usr/bin/env perl
# linode-cli
# Copyright (C) 2015 Linode, LLC
use 5.010;
use strict;
use warnings;
use FindBin;
use lib "$FindBin::RealBin/lib";
use Linode::CLI;
use Linode::CLI::Util ':basic';
my $mode = 'linode';
my $cmdargs = Linode::CLI::Util::eat_cmdargs($mode);
my $cli = Linode::CLI->new(
api_key => $cmdargs->{'api-key'},
mode => $mode,
opts => $cmdargs,
output_format => $cmdargs->{output},
wait => $cmdargs->{wait},
);
my $runaction = $cmdargs->{run};
$cli->$runaction;
$cli->response;
__END__
=head1 NAME
linode-linode - command-line interface for Linode instances
=head1 SYNOPSIS
B<linode-linode> [B<-a> action] [action-options...] [options...]
=over
=item S<-a create, --action create create and start a new Linode>
=item S<-a rebuild, --action rebuild rebuild an existing Linode>
=item S<-a start, --action start start a Linode>
=item S<-a stop, --action stop stop a Linode>
=item S<-a restart, --action restart restart a Linode>
=item S<-a rename, --action rename change a Linode's label>
=item S<-a group, --action group set a Linode's display group>
=item S<-a resize, --action resize resize a Linode and boot>
=item S<-a ip-add, --action ip-add add an IP address to a Linode>
=item S<-a delete, --action delete completely delete a Linode>
=item S<-a list, --action list list info about Linodes>
=item S<-a show, --action show show detailed info about a Linode>
=item S<-a locations, --action locations list all datacenters>
=item S<-a distros, --action distros list all distributions>
=item S<-a plans, --action plans list all Linode plans>
=item S<-a disk-list, --action disk-list list a Linode's disk>
=item S<-a image-list, --action image-list list available images>
=item S<-a image-create, --action image-create create a new image>
=item S<-a image-update, --action image-update update an existing image>
=item S<-a image-delete, --action image-delete delete an image>
=item S< --api-key=KEY your user's API key>
=item S<-h, --help display this help and exit>
=item S<-j, --json return output in JSON format>
=item S<-u, --username=USER username for Linode CLI account>
=back
=head1 OPTIONS
=over 8
=item B<-a>, B<--action>
An action to perform on one Linode. One of: B<create>, B<start>, B<stop>, B<restart>, B<rename>, B<group>, B<resize>, B<delete>.
Read-only operations are available as well: B<list>, B<show>.
Each action has a set of options that apply to it, which are outlined in the section B<ACTIONS>.
=item B<--api-key>
API key to use when communicating with the Linode API. The API key can also be set using an environment variable (LINODE_API_KEY). Alternatively, you can specify the API key in a B<.linodecli> file in the working user's home directory, using the format `api-key foobar`.
=item B<-u>, B<--username>:
Optional. Allows users to specify the username, if using with multiple accounts and configuration files.
=item B<-j>, B<--json>:
Optional. JSON output.
=item B<-h>, B<--help>
Displays help documentation.
=back
=head1 ACTIONS
=head2 CREATE
=over 8
=item Create and start a new Linode.
=over 8
=item B<-l>, B<--label>
Required. A Linode to operate on.
=item B<-L>, B<--location>
Required. The datacenter to use for deployment. Locations are Atlanta, Dallas, Frankfurt, Fremont, London, Newark, Singapore, Shinagawa.
=item B<-d>, B<--distribution>
Required when not using imageid. Distribution name or DistributionID to deploy.
=item B<-i>, B<--imageid>
Required when not using distribution. The ID of the gold-master image to use for deployment.
=item B<-p>, B<--plan>
Required. The Plan to deploy. Plans are linode1024, linode2048, linode4096, linode8192, linode12288, linode16384, linode24576, linode32768, linode49152, linode61440, linode65536, linode81920, linode102400, and linode204800.
=item B<-P>, B<--password>
Required. The root user's password. Needs to be at least 6 characters and contain at least two of these four character classes: lower case letters, upper case letters, numbers, and punctuation.
=item B<-t>, B<--payment-term>
Optional. Payment term, one of 1, 12, or 24 (months). Default: 1. This is ignored when using metered.
=item B<-g>, B<--group>
Optional. Linode Manager display group to place this Linode under. Default: none.
=item B<-K>, B<--pubkey-file>
Optional. A public key file to install at `/root/.ssh/authorized_keys` when creating this Linode.
=item B<-S>, B<--stackscript>
Optional. Personal or public StackScript ID to use for deployment. Names of personal StackScripts are accepted.
=item B<-J>, B<--stackscriptjson>
The JSON encoded name/value pairs, answering the StackScript's User Defined Fields (UDF). A path to a JSON file is also accepted.
=item B<-w>, B<--wait>
Optional. Amount of time (in minutes) to wait for human output. Using the flag only, will use the default of 5.
=back
=back
=head2 REBUILD
=over 8
=item Rebuild an existing Linode.
=over 8
=item B<-l>, B<--label>
Required. A Linode to operate on.
=item B<-d>, B<--distribution>
Required when not using imageid. Distribution name or DistributionID to deploy.
=item B<-i>, B<--imageid>
Required when not using distribution. The ID of the gold-master image to use for deployment.
=item B<-P>, B<--password>
Required. The root user's password. Needs to be at least 6 characters and contain at least two of these four character classes: lower case letters, upper case letters, numbers, and punctuation.
=item B<-K>, B<--pubkey-file>
Optional. A public key file to install at `/root/.ssh/authorized_keys` when creating this Linode.
=item B<-S>, B<--stackscript>
Optional. Personal or public StackScript ID to use for deployment. Names of personal StackScripts are accepted.
=item B<-J>, B<--stackscriptjson>
The JSON encoded name/value pairs, answering the StackScript's User Defined Fields (UDF). A path to a JSON file is also accepted.
=item B<-w>, B<--wait>
Optional. Amount of time (in minutes) to wait for human output. Using the flag only, will use the default of 5.
=back
=back
=head2 START
=over 8
=item Starts (boots) a Linode.
=over 8
=item B<-l>, B<--label>
A Linode to operate on.
=item B<-w>, B<--wait>
Optional. Amount of time (in minutes) to wait for human output. Using the flag only, will use the default of 5.
=back
=back
=head2 STOP
=over 8
=item Stops (powers down) a Linode.
=over 8
=item B<-l>, B<--label>
A Linode to operate on.
=item B<-w>, B<--wait>
Optional. Amount of time (in minutes) to wait for human output. Using the flag only, will use the default of 5.
=back
=back
=head2 RESTART
=over 8
=item Restart (reboots) a Linode.
=over 8
=item B<-l>, B<--label>
A Linode to operate on.
=item B<-w>, B<--wait>
Optional. Amount of time (in minutes) to wait for human output. Using the flag only, will use the default of 5.
=back
=back
=head2 RENAME
=over 8
=item Change a Linode's label.
=over 8
=item B<-l>, B<--label>
A Linode to operate on.
=item B<--new-label>
New label to apply to this Linode.
=back
=back
=head2 GROUP
=over 8
=item Set a Linode's display group.
=over 8
=item B<-g>, B<--group>
Linode Manager display group to place this Linode under.
=item B<-l>, B<--label>
A Linode to operate on.
=back
=back
=head2 RESIZE
=over 8
=item Resize a Linode to a new plan size, and issue a boot job.
=over 8
=item B<-l>, B<--label>
A Linode to operate on.
=item B<-p>, B<--plan>
The Plan to resize to. Plans are linode1024, linode2048, linode4096, linode8192, linode12288, linode16384, linode24576, linode32768, linode49152, linode61440, linode65536, linode81920, linode102400, and linode204800.
=item B<-w>, B<--wait>
Optional. Amount of time (in minutes) to wait for human output. Using the flag only, will use the default of 20.
=back
=back
=head2 IP-ADD
=over 8
=item Add an IP address to a Linode.
=over 8
=item B<-l>, B<--label>
A Linode to operate on.
=item B<--private>
Add a private IP address instead of a public one.
=back
=back
=head2 DELETE
=over 8
=item Delete a Linode, its disk image(s), and configuration profile(s).
=over 8
=item B<-l>, B<--label>
The Linode to Delete.
=back
=back
=head2 LIST
=over 8
=item List information about one or more Linodes. Linodes are grouped by their display group.
=over 8
=item B<-l>, B<--label>
Optional. A specific Linode to list.
=back
=back
=head2 SHOW
=over 8
=item Display detailed information about one or more Linodes.
=over 8
=item B<-l>, B<--label>
Required. A specific Linode to show.
=back
=back
=head2 LOCATIONS
=over 8
=item List all available datacenters.
=back
=head2 DISTROS
=over 8
=item List all available distributions.
=back
=head2 PLANS
=over 8
=item List all available Linode plans.
=back
=head2 DISK-LIST
=over 8
=item Lists disks associated with a specific Linode.
=over 8
=item B<-l>, B<--label>
Required. The Linode to display.
=back
=back
=head2 IMAGE-LIST
=over 8
=item Lists available gold-master images.
=back
=head2 IMAGE-CREATE
=over 8
=item Creates a gold-master image for future deployments.
=over 8
=item B<-l>, B<--label>
Required. Specifies the source Linode to create the image from.
=item B<-d>, B<--diskid>
Required. Specifies the source Disk ID to create the image from.
=item B<-D>, B<--description>
Optional. An optional description of the created image.
=item B<-n>, B<--name>
Optional. Sets the name of the image. If not provided, the name defaults to the source image label.
=item B<-w>, B<--wait>
Optional. Amount of time (in minutes) to wait for human output. Using the flag only, will use the default of 5.
=back
=back
=head2 IMAGE-UPDATE
=over 8
=item Updates a gold-master image.
=over 8
=item B<-i>, B<--imageid>
Required. The ID of the gold-master image to update.
=item B<-D>, B<--description>
Optional. The new image description.
=item B<-n>, B<--name>
Optional. The new image name.
=back
=back
=head2 IMAGE-DELETE
=over 8
=item Deletes a gold-master image.
=over 8
=item B<-i>, B<--imageid>
Required. The ID of the gold-master image to delete.
=back
=back
=head1 EXAMPLES
=head2 WORKING WITH MULTIPLE LINODES
=over 8
=item Actions can be performed on multiple Linodes using their labels. Using multiple --label arguments will accomplish the same thing.
=item $ linode start My-Linode-Label1 My-Linode-Label2
=item $ linode show --label My-Linode-Label1 --label My-Linode-Label2
=back
=head1 COPYRIGHT/LICENSE
Copyright 2015 Linode, LLC. Linode CLI is made available under the terms
of the Perl Artistic License, or GPLv2 at the recipients discretion.
=head2 Perl Artistic License
Read it at L<http://dev.perl.org/licenses/artistic.html>.
=head2 GNU General Public License (GPL) Version 2
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/
See the full license at L<http://www.gnu.org/licenses/>.
=cut