blib/lib/WebService/CloudProvider.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 30 CC 1 SCAR 6.9
CC
1
Cov
0%
commands
2.0
BUILD
2.0
BEGIN
2.0
CRAP 2.0
1 package WebService::CloudProvider;
2  
3 use 5.010;
4 use Mouse;
5  
6 # ABSTRACT: WebService::CloudProvider - an interface to cloudprovider.net's RESTful Web API using Web::API
7  
8 our $VERSION = '0.3'; # VERSION
9  
10 with 'Web::API';
11  
12  
13 has 'commands' => (
14 is => 'rw',
15 default => sub {
16 {
17 list_nodes => { method => 'GET' },
18 node_info => { method => 'GET', require_id => 1 },
19 create_node => {
20 method => 'POST',
21 default_attributes => {
22 allowed_hot_migrate => 1,
23 required_virtual_machine_build => 1,
24 cpu_shares => 5,
25 required_ip_address_assignment => 1,
26 primary_network_id => 1,
27 required_automatic_backup => 0,
28 swap_disk_size => 1,
29 },
30 mandatory => [
31 'label',
32 'hostname',
33 'template_id',
34 'cpus',
35 'memory',
36 'primary_disk_size',
37 'required_virtual_machine_build',
38 'cpu_shares',
39 'primary_network_id',
40 'required_ip_address_assignment',
41 'required_automatic_backup',
42 'swap_disk_size',
43 ]
44 },
45 update_node => { method => 'PUT', require_id => 1 },
46 delete_node => { method => 'DELETE', require_id => 1 },
47 start_node => {
48 method => 'POST',
49 require_id => 1,
50 post_id_path => 'startup',
51 },
52 stop_node => {
53 method => 'POST',
54 require_id => 1,
55 post_id_path => 'shutdown',
56 },
57 suspend_node => {
58 method => 'POST',
59 require_id => 1,
60 post_id_path => 'suspend',
61 },
62 };
63 },
64 );
65  
66  
67 sub commands {
68 my ($self) = @_;
69 return $self->commands;
70 }
71  
72  
73 sub BUILD {
74 my ($self) = @_;
75  
76 $self->user_agent(__PACKAGE__ . ' ' . $VERSION);
77 $self->base_url('https://ams01.cloudprovider.net/virtual_machines');
78 $self->auth_type('basic');
79 $self->content_type('application/json');
80 $self->extension('json');
81 $self->wrapper('virtual_machine');
82 $self->mapping({
83 os => 'template_id',
84 debian => 1,
85 id => 'label',
86 disk_size => 'primary_disk_size',
87 });
88  
89 return $self;
90 }
91  
92  
93 1; # End of WebService::CloudProvider
94  
95 __END__