This repository has been archived by the owner on Jul 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Datacenter.pm
136 lines (77 loc) · 2.76 KB
/
Datacenter.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
package Conch::Route::Datacenter;
use Mojo::Base -strict;
=pod
=head1 NAME
Conch::Route::Datacenter
=head1 METHODS
=head2 routes
Sets up the routes for /dc.
=cut
sub routes {
my $class = shift;
my $dc = shift; # secured, under /dc
$dc = $dc->require_system_admin->to({ controller => 'datacenter' });
# GET /dc
$dc->get('/')->to('#get_all', response_schema => 'Datacenters');
# POST /dc
$dc->post('/')->to('#create', request_schema => 'DatacenterCreate');
my $with_datacenter = $dc->under('/<datacenter_id:uuid>')->to('#find_datacenter');
# GET /dc/:datacenter_id
$with_datacenter->get('/')->to('#get_one', response_schema => 'Datacenter');
# POST /dc/:datacenter_id
$with_datacenter->post('/')->to('#update', request_schema => 'DatacenterUpdate');
# DELETE /dc/:datacenter_id
$with_datacenter->delete('/')->to('#delete');
# GET /dc/:datacenter_id/rooms
$with_datacenter->get('/rooms')->to('#get_rooms', response_schema => 'DatacenterRoomsDetailed');
}
1;
__END__
=pod
=head1 ROUTE ENDPOINTS
All routes require authentication.
=head2 C<GET /dc>
=over 4
=item * Requires system admin authorization
=item * Controller/Action: L<Conch::Controller::Datacenter/get_all>
=item * Response: F<response.yaml#/$defs/Datacenters>
=back
=head2 C<POST /dc>
=over 4
=item * Requires system admin authorization
=item * Controller/Action: L<Conch::Controller::Datacenter/create>
=item * Request: F<request.yaml#/$defs/DatacenterCreate>
=item * Response: C<201 Created> or C<204 No Content>, plus Location header
=back
=head2 C<GET /dc/:datacenter_id>
=over 4
=item * Requires system admin authorization
=item * Controller/Action: L<Conch::Controller::Datacenter/get_one>
=item * Response: F<response.yaml#/$defs/Datacenter>
=back
=head2 C<POST /dc/:datacenter_id>
=over 4
=item * Requires system admin authorization
=item * Controller/Action: L<Conch::Controller::Datacenter/update>
=item * Request: F<request.yaml#/$defs/DatacenterUpdate>
=item * Response: C<204 No Content>, plus Location header
=back
=head2 C<DELETE /dc/:datacenter_id>
=over 4
=item * Requires system admin authorization
=item * Controller/Action: L<Conch::Controller::Datacenter/delete>
=item * Response: C<204 No Content>
=back
=head2 C<GET /dc/:datacenter_id/rooms>
=over 4
=item * Requires system admin authorization
=item * Controller/Action: L<Conch::Controller::Datacenter/get_rooms>
=item * Response: F<response.yaml#/$defs/DatacenterRoomsDetailed>
=back
=head1 LICENSING
Copyright Joyent, Inc.
This Source Code Form is subject to the terms of the Mozilla Public License,
v.2.0. If a copy of the MPL was not distributed with this file, You can obtain
one at L<https://www.mozilla.org/en-US/MPL/2.0/>.
=cut
# vim: set sts=2 sw=2 et :