Conch API

Logo

Datacenter build and management service

View the Project on GitHub joyent/conch-api

Conch::Controller::Rack

SOURCE

https://github.com/joyent/conch-api/blob/master/lib/Conch/Controller/Rack.pm

METHODS

find_rack

Chainable action that uses the rack_id_or_name value provided in the stash (usually via the request URL) to look up a rack (constraining to the datacenter_room if datacenter_room_rs is also provided) and stashes the query to get to it in rack_rs.

When datacenter_room information is not provided, rack_id_or_name must be either a uuid or a “long” rack name (“vendor_name” in Conch::DB::Result::DatacenterRoom) plus “name” in Conch::DB::Result::Rack); otherwise, it can also be a short rack name “name” in Conch::DB::Result::Rack).

If require_role is provided in the stash, it is used as the minimum required role for the user to continue; otherwise the HTTP method is used to determine its value (HEAD and GET imply read-only, POST, PUT and DELETE imply read/write); or the user must be a system admin.

create

Stores data as a new rack row.

get

Get a single rack

Response uses the Rack json schema.

get_layouts

Gets all the layouts for the specified rack.

Response uses the RackLayouts json schema.

overwrite_layouts

Given the layout definitions for an entire rack, removes all existing layouts that are not in the new definition, as well as removing any device_location assignments in those layouts.

update

Update an existing rack.

delete

Delete a rack.

get_assignment

Gets all the rack layout assignments (including occupying devices) for the specified rack.

Response uses the RackAssignments json schema.

set_assignment

Assigns devices to rack layouts, also optionally updating serial_numbers and asset_tags (and creating the device if needed). Existing devices in referenced slots will be unassigned as needed.

Note: the assignment is still performed even if there is no physical room in the rack for the new hardware (its rack_unit_size overlaps into a subsequent layout), or if the device’s hardware doesn’t match what the layout specifies.

delete_assignment

set_phase

Updates the phase of this rack, and optionally all devices located in this rack.

Use the rack_only query parameter to specify whether to only update the rack’s phase, or all located devices’ phases as well.

Appends the provided link(s) to the rack.

When a payload is specified, remove specified links from the rack; with a null payload, removes all links.

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/.