This reverts commit 048b0f7720
.
Change-Id: Ib6c006507e3ec1ee5350af6138a803c9a4ca0e31
changes/41/25041/2
parent
f08e982511
commit
72c771ec87
@ -0,0 +1,58 @@
|
||||
package NGCP::Panel::Controller::API::TimeSets;
|
||||
use NGCP::Panel::Utils::Generic qw(:all);
|
||||
|
||||
use Sipwise::Base;
|
||||
use parent qw/NGCP::Panel::Role::Entities NGCP::Panel::Role::API::TimeSets/;
|
||||
|
||||
use HTTP::Status qw(:constants);
|
||||
use NGCP::Panel::Utils::TimeSet;
|
||||
|
||||
__PACKAGE__->set_config({
|
||||
allowed_roles => [qw/admin reseller/],
|
||||
});
|
||||
|
||||
sub allowed_methods{
|
||||
return [qw/GET POST OPTIONS HEAD/];
|
||||
}
|
||||
|
||||
sub api_description {
|
||||
return 'Defines a collection of (generic) Time Sets, which can each specify a number of ' .
|
||||
'(recurring) time-slots, which can be currently used in PeeringRules to select certain peerings.';
|
||||
}
|
||||
|
||||
sub query_params {
|
||||
return [
|
||||
{
|
||||
param => 'reseller_id',
|
||||
description => 'Filter for Time Sets belonging to a specific reseller',
|
||||
query_type => 'string_eq',
|
||||
},
|
||||
{
|
||||
param => 'name',
|
||||
description => 'Filter for items matching a Time Set name pattern',
|
||||
query_type => 'string_like',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub create_item {
|
||||
my ($self, $c, $resource, $form, $process_extras) = @_;
|
||||
|
||||
my $schema = $c->model('DB');
|
||||
my $tset;
|
||||
|
||||
try {
|
||||
# # no checks, they are in check_resource
|
||||
$tset = NGCP::Panel::Utils::TimeSet::create_timesets( c => $c, resource => $resource );
|
||||
} catch($e) {
|
||||
$c->log->error("failed to create timeset: $e");
|
||||
$self->error($c, HTTP_INTERNAL_SERVER_ERROR, "Failed to create timeset.");
|
||||
return;
|
||||
}
|
||||
|
||||
return $tset;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
# vim: set tabstop=4 expandtab:
|
@ -0,0 +1,32 @@
|
||||
package NGCP::Panel::Controller::API::TimeSetsItem;
|
||||
use NGCP::Panel::Utils::Generic qw(:all);
|
||||
|
||||
use Sipwise::Base;
|
||||
use parent qw/NGCP::Panel::Role::EntitiesItem NGCP::Panel::Role::API::TimeSets/;
|
||||
|
||||
use HTTP::Status qw(:constants);
|
||||
|
||||
__PACKAGE__->set_config({
|
||||
allowed_roles => {
|
||||
Default => [qw/admin reseller/],
|
||||
Journal => [qw/admin reseller/],
|
||||
},
|
||||
PATCH => { ops => [qw/add replace remove copy/] },
|
||||
});
|
||||
|
||||
sub allowed_methods{
|
||||
return [qw/GET OPTIONS HEAD PATCH PUT DELETE/];
|
||||
}
|
||||
|
||||
sub journal_query_params {
|
||||
my($self,$query_params) = @_;
|
||||
return $self->get_journal_query_params($query_params);
|
||||
}
|
||||
|
||||
sub get_journal_methods{
|
||||
return [qw/handle_item_base_journal handle_journals_get handle_journalsitem_get handle_journals_options handle_journalsitem_options handle_journals_head handle_journalsitem_head/];
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
# vim: set tabstop=4 expandtab:
|
Loading…
Reference in new issue