Casey Vega

NAME

WWW::MediaTemple - A Perl interface to the Media Temple API

VERSION

Version 0.02

SYNPOSIS

    use WWW::MediaTemple;

    my $api = WWW::MediaTemple->new(
        api_key => 'your_api_key'
    );

    $api->setRootPasswd( serviceId => '000001',
                         password  => '!f4k3p455w0rd'
    );

DESCRIPTION

This module is intended to provide an interface between Perl and the Media Temple API. The Media Temple API is a RESTful web service. In order to use this module you must provide an api key which requires a valid account. For more information please see http://wiki.mediatemple.net/w/Category:API

CONSTRUCTOR

new()

Creates and returns a new WWW::MediaTemple object

    my $api= WWW::MediaTemple->new()
  • api_key => [your_api_key]

    The api_key parameter is required. You must provide a valid key.

  • pretty_print => [true|false}

    This parameter allows you to enable the pretty print function of the API. By default this parameter is set to true

  • wrap_root => [true|false]

    This parameter defaults to 'true'. It wraps the json object with the root object name. Specifying 'false' will not wrap the object.

  • format => [json|xml]

    The data format you intend PUT, POST and GET. Currently defaults to JSON

  • raw_data => [true|false]

    Return raw data in xml and or json format opposed to an object

SUBROUTINES/METHODS

$obj->services

get the service info for all services

$obj->serviceIds

get a list of all service ids

$obj->service(...)

get the service info for a single service

* serviceId (integer, required: true, default: none)

    $obj->service( serviceId => 000001 );

$obj->serviceTypes

get a list of valid service types

$obj->serviceOSTypes

get a list of OS's that can be installed on a (ve)

$obj->addService(...)

create a new service

* serviceType (integer, required: true, default: none)

* primaryDomain (string, required: true(dv only), default: none, (ve) autogenerates a domain)

* operatingSystem (integer, required: true, default: Ubuntu 9.10 (16) )

    $obj->addService( operatingSystem => 16, 
                      serviceType     => 000001,
                      primaryDomain   => 'snakeoil.dom'
    );

$obj->reboot(...)

reboot the specified service

* serviceId integer, required: true, default: none

    $obj->reboot( serviceId => 000001 );

$obj->flushFirewall(...)

flushes the firewall rules on the specified service

* serviceId integer, required: true, default: none

    $obj->flushFirewall( serviceId => 000001 );

$obj->addTempDisk(...)

adds temporary disk space for the specified service

* serviceId integer, required: true, default: none

    $obj->addTempDisk( serviceId => 000001 );

$obj->pleskPassword(...)

set plesk password for the specified service

* serviceId integer, required: true, default: none

    $obj->pleskPassword( serviceId => 000001 );

$obj->setRootPass(...)

set the root password for the specified service

* serviceId integer, required: true, default: none

    $obj->setRootPass( serviceId => 000001 );

$obj->stats(...)

get the stats for a single service

* start (integer, required: false, default: none, beginning range in epoch seconds)

* end (integer, required: false, default: none, end range in epoch seconds

* resolution (integer, required: false, default: 15, The interval of data points in seconds to request

* precision (integer, required: false, default: 2, Digits to the right of the decimal

* predefined (integer, required: false, default: get stats over a predefined range (5min, 1year)

* NOTE: When using a predefined range the start option will be ignored

    $obj->stats( predefined => '5min', 
                 resolution => 10,
                 precision  => 5
    );

$obj->warnings

get the service warnings for an account

$obj->thresholds

get the service warning thresholds

_dumper

convert API output into XML, JSON or raw output based on constructor parameters

DIAGNOSTICS

N/A at the current point in time

CONFIGURATION AND ENVIRONMENT

No special configuration and or configuration files are needed. This module is intended to run in any and all environment.

INCOMPATIBILITIES

This package is intended to be compatible with Perl 5.008 and beyond.

BUGS AND LIMITATIONS

Please use https://forums.mediatemple.net to provide bug reports and or feedback concerning the API.

DEPENDENCIES

REST::Client, XML::Simple, JSON

SEE ALSO

http://mediatemple.net/api

SUPPORT

The module is provided free of support however feel free to contact the author or current maintainer with questions, bug reports, and patches.

Considerations will be taken when making changes to the API. Any changes to its interface will go through at the least one deprecation cycle.

LICENSE AND COPYRIGHT

Copyright (c) 2011 (mt) Media Temple, INC.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

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.

Author

Casey Vega <cvega@mediatemple.net>