Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Commit

Permalink
move /validation_plan and /validation_state routes off to their own f…
Browse files Browse the repository at this point in the history
…iles
  • Loading branch information
karenetheridge committed Nov 2, 2020
1 parent c90f582 commit 5d63aa6
Show file tree
Hide file tree
Showing 12 changed files with 244 additions and 96 deletions.
4 changes: 4 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ Available top-level routes are:

* [Conch::Route::Validation](modules/Conch::Route::Validation)
* `/validation`

* [Conch::Route::ValidationPlan](modules/Conch::Route::ValidationPlan)
* `/validation_plan`

* [Conch::Route::ValidationState](modules/Conch::Route::ValidationState)
* `/validation_state`

* [Conch::Route::Workspace](modules/Conch::Route::Workspace)
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/Conch::Controller::ValidationPlan.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Conch::Controller::Validation
# Conch::Controller::ValidationPlan

## SOURCE

Expand Down
10 changes: 9 additions & 1 deletion docs/modules/Conch::Route.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,18 @@ See ["unsecured\_routes" in Conch::Route::JSONSchema](../modules/Conch%3A%3ARout

See ["routes" in Conch::Route::User](../modules/Conch%3A%3ARoute%3A%3AUser#routes)

### `* /validation`, `* /validation_plan`, `* /validation_state`
### `* /validation`

See ["routes" in Conch::Route::Validation](../modules/Conch%3A%3ARoute%3A%3AValidation#routes)

### `* /validation_plan`

See ["routes" in Conch::Route::ValidationPlan](../modules/Conch%3A%3ARoute%3A%3AValidationPlan#routes)

### `* /validation_state`

See ["routes" in Conch::Route::ValidationState](../modules/Conch%3A%3ARoute%3A%3AValidationState#routes)

### `* /workspace`

See ["routes" in Conch::Route::Workspace](../modules/Conch%3A%3ARoute%3A%3AWorkspace#routes).
Expand Down
22 changes: 1 addition & 21 deletions docs/modules/Conch::Route::Validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

### routes

Sets up the routes for /validation, /validation\_plan and /validation\_state.
Sets up the routes for /validation.

## ROUTE ENDPOINTS

Expand All @@ -24,26 +24,6 @@ All routes require authentication.
- Controller/Action: ["get" in Conch::Controller::Validation](../modules/Conch%3A%3AController%3A%3AValidation#get)
- Response: [response.json#/definitions/Validation](../json-schema/response.json#/definitions/Validation)

### `GET /validation_plan`

- Controller/Action: ["get\_all" in Conch::Controller::ValidationPlan](../modules/Conch%3A%3AController%3A%3AValidationPlan#get_all)
- Response: [response.json#/definitions/ValidationPlans](../json-schema/response.json#/definitions/ValidationPlans)

### `GET /validation_plan/:validation_plan_id_or_name`

- Controller/Action: ["get" in Conch::Controller::ValidationPlan](../modules/Conch%3A%3AController%3A%3AValidationPlan#get)
- Response: [response.json#/definitions/ValidationPlan](../json-schema/response.json#/definitions/ValidationPlan)

### `GET /validation_plan/:validation_plan_id_or_name/validation`

- Controller/Action: ["validations" in Conch::Controller::ValidationPlan](../modules/Conch%3A%3AController%3A%3AValidationPlan#validations)
- Response: [response.json#/definitions/Validations](../json-schema/response.json#/definitions/Validations)

### `GET /validation_state/:validation_state_id`

- Controller/Action: ["get" in Conch::Controller::ValidationState](../modules/Conch%3A%3AController%3A%3AValidationState#get)
- Response: [response.json#/definitions/ValidationStateWithResults](../json-schema/response.json#/definitions/ValidationStateWithResults)

## LICENSING

Copyright Joyent, Inc.
Expand Down
38 changes: 38 additions & 0 deletions docs/modules/Conch::Route::ValidationPlan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Conch::Route::ValidationPlan

## SOURCE

[https://github.com/joyent/conch-api/blob/master/lib/Conch/Route/ValidationPlan.pm](https://github.com/joyent/conch-api/blob/master/lib/Conch/Route/ValidationPlan.pm)

## METHODS

### routes

Sets up the routes for /validation\_plan.

## ROUTE ENDPOINTS

All routes require authentication.

### `GET /validation_plan`

- Controller/Action: ["get\_all" in Conch::Controller::ValidationPlan](../modules/Conch%3A%3AController%3A%3AValidationPlan#get_all)
- Response: [response.json#/definitions/ValidationPlans](../json-schema/response.json#/definitions/ValidationPlans)

### `GET /validation_plan/:validation_plan_id_or_name`

- Controller/Action: ["get" in Conch::Controller::ValidationPlan](../modules/Conch%3A%3AController%3A%3AValidationPlan#get)
- Response: [response.json#/definitions/ValidationPlan](../json-schema/response.json#/definitions/ValidationPlan)

### `GET /validation_plan/:validation_plan_id_or_name/validation`

- Controller/Action: ["validations" in Conch::Controller::ValidationPlan](../modules/Conch%3A%3AController%3A%3AValidationPlan#validations)
- Response: [response.json#/definitions/Validations](../json-schema/response.json#/definitions/Validations)

## 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 [https://www.mozilla.org/en-US/MPL/2.0/](https://www.mozilla.org/en-US/MPL/2.0/).
28 changes: 28 additions & 0 deletions docs/modules/Conch::Route::ValidationState.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Conch::Route::ValidationState

## SOURCE

[https://github.com/joyent/conch-api/blob/master/lib/Conch/Route/ValidationState.pm](https://github.com/joyent/conch-api/blob/master/lib/Conch/Route/ValidationState.pm)

## METHODS

### routes

Sets up the routes for /validation\_state.

## ROUTE ENDPOINTS

All routes require authentication.

### `GET /validation_state/:validation_state_id`

- Controller/Action: ["get" in Conch::Controller::ValidationState](../modules/Conch%3A%3AController%3A%3AValidationState#get)
- Response: [response.json#/definitions/ValidationStateWithResults](../json-schema/response.json#/definitions/ValidationStateWithResults)

## 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 [https://www.mozilla.org/en-US/MPL/2.0/](https://www.mozilla.org/en-US/MPL/2.0/).
2 changes: 2 additions & 0 deletions docs/modules/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@
* [Conch::Route::Relay](../modules/Conch::Route::Relay)
* [Conch::Route::User](../modules/Conch::Route::User)
* [Conch::Route::Validation](../modules/Conch::Route::Validation)
* [Conch::Route::ValidationPlan](../modules/Conch::Route::ValidationPlan)
* [Conch::Route::ValidationState](../modules/Conch::Route::ValidationState)
* [Conch::Route::Workspace](../modules/Conch::Route::Workspace)
* [Conch::Time](../modules/Conch::Time)
* [Conch::UUID](../modules/Conch::UUID)
Expand Down
2 changes: 1 addition & 1 deletion lib/Conch/Controller/ValidationPlan.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use Conch::UUID 'is_uuid';
=head1 NAME
Conch::Controller::Validation
Conch::Controller::ValidationPlan
Controller for managing Validation Plans
Expand Down
16 changes: 14 additions & 2 deletions lib/Conch/Route.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ use Conch::Route::RackLayout;
use Conch::Route::HardwareVendor;
use Conch::Route::Organization;
use Conch::Route::Build;
use Conch::Route::ValidationPlan;
use Conch::Route::ValidationState;

=pod
Expand Down Expand Up @@ -148,7 +150,7 @@ Returns the root node.
Conch::Route::Relay->routes($secured->any('/relay'));
Conch::Route::User->routes($secured->any('/user'));
Conch::Route::HardwareProduct->routes($secured->any('/hardware_product'));
Conch::Route::Validation->routes($secured);
Conch::Route::Validation->routes($secured->any('/validation'));
Conch::Route::Datacenter->routes($secured->any('/dc'));
Conch::Route::DatacenterRoom->routes($secured->any('/room'));
Conch::Route::RackRole->routes($secured->any('/rack_role'));
Expand All @@ -157,6 +159,8 @@ Returns the root node.
Conch::Route::HardwareVendor->routes($secured->any('/hardware_vendor'));
Conch::Route::Organization->routes($secured->any('/organization'));
Conch::Route::Build->routes($secured->any('/build'));
Conch::Route::ValidationPlan->routes($secured->any('/validation_plan'));
Conch::Route::ValidationState->routes($secured->any('/validation_state'));

# find all the top level path components: these are the only paths that we will send rollbar alerts for
state sub find_paths ($route) {
Expand Down Expand Up @@ -326,10 +330,18 @@ See L<Conch::Route::JSONSchema/unsecured_routes>
See L<Conch::Route::User/routes>
=head2 C<* /validation>, C<* /validation_plan>, C<* /validation_state>
=head2 C<* /validation>
See L<Conch::Route::Validation/routes>
=head2 C<* /validation_plan>
See L<Conch::Route::ValidationPlan/routes>
=head2 C<* /validation_state>
See L<Conch::Route::ValidationState/routes>
=head2 C<* /workspace>
See L<Conch::Route::Workspace/routes>.
Expand Down
72 changes: 2 additions & 70 deletions lib/Conch/Route/Validation.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ Conch::Route::Validation
=head2 routes
Sets up the routes for /validation, /validation_plan and /validation_state.
Sets up the routes for /validation.
=cut

sub routes {
my $class = shift;
my $r = shift; # secured, under /
my $v = shift; # secured, under /validation

# all these /validation routes go to the Validation controller
my $v = $r->any('/validation');
$v->to({ controller => 'validation' });

# GET /validation
Expand All @@ -33,32 +31,6 @@ sub routes {
# GET /validation/:validation_id_or_name
$with_validation->get('/')->to('#get');
}


# all these /validation_plan routes go to the ValidationPlan controller
my $vp = $r->any('/validation_plan');
$vp->to({ controller => 'validation_plan' });

# GET /validation_plan
$vp->get('/')->to('#get_all');

{
my $with_plan = $vp->under('/:validation_plan_id_or_name')->to('#find_validation_plan');

# GET /validation_plan/:validation_plan_id_or_name
$with_plan->get('/')->to('#get');

# GET /validation_plan/:validation_plan_id_or_name/validation
$with_plan->get('/validation')->to('#get_validations');
}

{
my $vs = $r->any('/validation_state');
$vs->to({ controller => 'validation_state' });

# GET /validation_state/:validation_state_id
$vs->get('/<validation_state_id:uuid>')->to('#get');
}
}

1;
Expand Down Expand Up @@ -90,46 +62,6 @@ All routes require authentication.
=back
=head2 C<GET /validation_plan>
=over 4
=item * Controller/Action: L<Conch::Controller::ValidationPlan/get_all>
=item * Response: F<response.yaml#/definitions/ValidationPlans>
=back
=head2 C<GET /validation_plan/:validation_plan_id_or_name>
=over 4
=item * Controller/Action: L<Conch::Controller::ValidationPlan/get>
=item * Response: F<response.yaml#/definitions/ValidationPlan>
=back
=head2 C<GET /validation_plan/:validation_plan_id_or_name/validation>
=over 4
=item * Controller/Action: L<Conch::Controller::ValidationPlan/validations>
=item * Response: F<response.yaml#/definitions/Validations>
=back
=head2 C<GET /validation_state/:validation_state_id>
=over 4
=item * Controller/Action: L<Conch::Controller::ValidationState/get>
=item * Response: F<response.yaml#/definitions/ValidationStateWithResults>
=back
=head1 LICENSING
Copyright Joyent, Inc.
Expand Down
87 changes: 87 additions & 0 deletions lib/Conch/Route/ValidationPlan.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package Conch::Route::ValidationPlan;

use Mojo::Base -strict;

=pod
=head1 NAME
Conch::Route::ValidationPlan
=head1 METHODS
=head2 routes
Sets up the routes for /validation_plan.
=cut

sub routes {
my $class = shift;
my $vp = shift; # secured, under /validation_plan

$vp->to({ controller => 'validation_plan' });

# GET /validation_plan
$vp->get('/')->to('#get_all');

{
my $with_plan = $vp->under('/:validation_plan_id_or_name')->to('#find_validation_plan');

# GET /validation_plan/:validation_plan_id_or_name
$with_plan->get('/')->to('#get');

# GET /validation_plan/:validation_plan_id_or_name/validation
$with_plan->get('/validation')->to('#get_validations');
}
}

1;
__END__
=pod
=head1 ROUTE ENDPOINTS
All routes require authentication.
=head2 C<GET /validation_plan>
=over 4
=item * Controller/Action: L<Conch::Controller::ValidationPlan/get_all>
=item * Response: F<response.yaml#/definitions/ValidationPlans>
=back
=head2 C<GET /validation_plan/:validation_plan_id_or_name>
=over 4
=item * Controller/Action: L<Conch::Controller::ValidationPlan/get>
=item * Response: F<response.yaml#/definitions/ValidationPlan>
=back
=head2 C<GET /validation_plan/:validation_plan_id_or_name/validation>
=over 4
=item * Controller/Action: L<Conch::Controller::ValidationPlan/validations>
=item * Response: F<response.yaml#/definitions/Validations>
=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 ts=4 sts=4 sw=4 et :
Loading

0 comments on commit 5d63aa6

Please sign in to comment.