Conch API

Logo

Datacenter build and management service

View the Project on GitHub joyent/conch-api

NAME

Conch::DB::ResultSet::Device

DESCRIPTION

Interface to queries involving devices.

METHODS

user_has_permission

Checks that the provided user_id has (at least) the specified permission in at least one workspace associated with the specified device(s), including parent workspaces.

devices_without_location

Restrict results to those that do not have a registered location.

latest_device_report

Returns a resultset that finds the most recent device report matching the device(s). This is not a window function, so only one report is returned for all matching devices, not one report per device! (We probably never need to do the latter. *)

* but if we did, you’d want something like:

$self->search(undef, {
    '+columns' => {
        $col => $self->correlate('device_reports')
            ->columns($col)
            ->order_by({ -desc => 'device_reports.created' })
            ->rows(1)
            ->as_query
    },
});

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 http://mozilla.org/MPL/2.0/.