How to use the uuid function from assert-plus

Find comprehensive JavaScript assert-plus.uuid code examples handpicked from public code repositorys.

103
104
105
106
107
108
109
110
111
112
var log = api.log;

return function findExternalNetworkWithOwnerUuid(opts, cb) {
    assert.object(opts, 'opts');
    assert.object(opts.account, 'opts.account');
    assert.uuid(opts.req_id, 'opts.req_id');

    log.debug('Running ' + findExternalNetworkWithOwnerUuid.name);

    var accountUuid = opts.account.uuid;
fork icon49
star icon183
watch icon0

3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
/*
 * Manta allows us to make a request to the top-level upload directory as
 * if the multipart upload was anchored there.  The response will be a
 * redirect to the fully-qualified upload directory.
 */
assert.uuid(uu.uu_id, 'uu_id');
assert.object(uu.uu_opts, 'uu_opts');
var idurl = baseURL + '/' + uu.uu_id;
var options = createOptions({
    path: idurl
fork icon41
star icon75
watch icon0

498
499
500
501
502
503
504
505
506
507
508
 *
 * @param {String} - UUID
 * @param {Function} callback of the form `function (err, network, res)`
 */
CloudApi.prototype.getNetwork = function getNetwork(id, cb) {
    assert.uuid(id, 'id');
    assert.func(cb, 'cb');


    var endpoint = this._path(format('/%s/networks/%s', this.account, id));
    this._request(endpoint, function (err, req, res, body) {
fork icon38
star icon55
watch icon0

+ 475 other calls in file

1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
 */
IMGADM.prototype._importImage = function _importImage(opts, cb) {
    var self = this;
    assert.object(opts, 'opts');
    assert.object(opts.importInfo, 'opts.importInfo');
    assert.uuid(opts.importInfo.uuid, 'opts.importInfo.uuid');
    assert.object(opts.importInfo.source, 'opts.importInfo.source');
    assert.string(opts.zpool, 'opts.zpool');
    assert.optionalBool(opts.zstream, 'opts.zstream');
    assert.optionalBool(opts.quiet, 'opts.quiet');
fork icon248
star icon0
watch icon0

415
416
417
418
419
420
421
422
423
424
425
426


/*
 * Convert a UUID to a short ID
 */
function uuidToShortId(s) {
    assert.uuid(s, 's');
    return s.split('-', 1)[0];
}


/*
fork icon38
star icon55
watch icon41

+ 3 other calls in file

298
299
300
301
302
303
304
305
306
307

function deleteSubusers(ctx, next) {
    vasync.forEachPipeline({
        inputs: ctx.subusersToDelete,
        func: function delOneSubuser(subuser, nextSubuser) {
            assert.uuid(subuser.id, 'subuser.id');
            ctx.smardcClient.deleteUser(opts.account.login, subuser.id,
                nextSubuser);
        }
    }, function (err) {
fork icon16
star icon13
watch icon0

+ 9 other calls in file

840
841
842
843
844
845
846
847
848
849
850
 * updated. We no longer need to execute partial updates
 */
Moray.prototype.putVm = function putVm(uuid, vm, oldVm, cb) {
    var self = this;


    assert.uuid(uuid, 'uuid');
    assert.object(vm, 'vm');
    assert.object(oldVm, 'oldVm');
    assert.func(cb, 'cb');

fork icon20
star icon11
watch icon0

+ 5 other calls in file

771
772
773
774
775
776
777
778
779
    };
}

// Allow overriding of the target server.
if (req.params.override_server_uuid) {
    assert.uuid(req.params.override_server_uuid,
        'req.params.override_server_uuid');
    record.target_server_uuid = req.params.override_server_uuid;
}
fork icon20
star icon11
watch icon0

+ 2 other calls in file

28
29
30
31
32
33
34
35
36
37
38
39


function validateFabricNetworkOwnership(napiClient, volumeParams, callback) {
    assert.object(napiClient, 'napiClient');
    assert.object(volumeParams, 'volumeParams');
    assert.arrayOfUuid(volumeParams.networks, 'volumeParams.networks');
    assert.uuid(volumeParams.owner_uuid, 'volumeParams.owner_uuid');
    assert.func(callback, 'callback');


    var missing = [];
    var nonFabric = [];
fork icon6
star icon8
watch icon0

+ 3 other calls in file

281
282
283
284
285
286
287
288
289
290
        ctx.instanceUuid = instanceUuid;
        next(err);
    });
},
function initChangefeedListener(ctx, next) {
    mod_assert.uuid(ctx.instanceUuid, 'ctx.instanceUuid');

    var options = {
        backoff: {
            maxTimeout: Infinity,
fork icon6
star icon8
watch icon0

+ 13 other calls in file

2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
// (`ctx.config`) with the given server, image, and, if
// applicable, shard.
let addInst = function(svr, svcName, img, shard) {
    assertplus.uuid(svr, 'svr');
    assertplus.string(svcName, 'svcName');
    assertplus.uuid(img, 'img');
    assertplus.optionalString(shard, 'shard');

    if (!ctx.config[svr]) {
        ctx.config[svr] = {};
fork icon13
star icon7
watch icon42

+ 4 other calls in file

72
73
74
75
76
77
78
79
80
81
82


function _buildStorageVMPayload(version, volumeParams, storageVmUuid,
        billingPackage, affinity) {
    assert.number(version, 'version');
    assert.object(volumeParams, 'volumeParams');
    assert.uuid(storageVmUuid, 'storageVmUuid');
    assert.object(billingPackage, 'billingPackage');
    assert.string(billingPackage.uuid, 'billingPackage.uuid');
    assert.optionalArray(affinity, 'affinity');
    assert.uuid(CONFIG.nfsServerImageUuid, 'CONFIG.nfsServerImageUuid');
fork icon6
star icon8
watch icon0

+ 13 other calls in file

266
267
268
269
270
271
272
273
274
    callback = options;
    options = undefined;
}

assert.object(params, 'params');
assert.uuid(params.uuid, 'params.uuid');
assert.optionalUuid(params.owner_uuid, 'params.owner_uuid');
assert.optionalObject(options, 'options');
assert.func(callback, 'callback');
fork icon13
star icon2
watch icon0

+ 25 other calls in file

90
91
92
93
94
95
96
97
98
99
100
101
TritonTracer.prototype.inject = function inject(spanCtx, format, carrier) {
    var self = this;


    assert.object(spanCtx, 'spanCtx');
    assert.uuid(spanCtx._spanId, 'spanCtx._spanId');
    assert.uuid(spanCtx._traceId, 'spanCtx._traceId');
    assert.equal(format, opentracing.FORMAT_TEXT_MAP, 'Unsupported format');
    assert.object(carrier, 'carrier');


    // We only support "TextMap" format which we assume for now is a restify
fork icon4
star icon0
watch icon0

+ 5 other calls in file

86
87
88
89
90
91
92
93
94
95
    if (opts.sysinfo) {
        assertSysinfo(opts.sysinfo);
        self.sysinfo = opts.sysinfo;
        self.serverUuid = opts.sysinfo.UUID;
    } else {
        assert.uuid(opts.serverUuid, 'opts.serverUuid');
        self.serverUuid = opts.serverUuid;
    }
}

fork icon3
star icon3
watch icon0

+ 19 other calls in file

1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
IMGAPI.prototype.addImageFileFromUrl = function addImageFileFromUrl(
    options, account, callback) {


    var self = this;
    assert.object(options, 'options');
    assert.uuid(options.uuid, 'options.uuid');
    assert.string(options.file_url, 'options.file_url');
    assert.optionalString(options.compression, 'options.compression');


    assert.optionalObject(options.headers, 'options.headers');
fork icon13
star icon2
watch icon36

+ 2 other calls in file

283
284
285
286
287
288
289
290
291
292
var local = false;
var span = {};
var name;
var proto = {};

assert.uuid(obj.spanId, 'obj.spanId');
assert.uuid(obj.traceId, 'obj.traceId');
if (obj.parentSpanId !== '0') {
    assert.optionalUuid(obj.parentSpanId, 'obj.parentSpanId');
}
fork icon2
star icon1
watch icon0

+ 5 other calls in file