Skip to content

Commit

Permalink
TritonDataCenter#84 AddNic should accept a "primary" argument
Browse files Browse the repository at this point in the history
  • Loading branch information
arekinath committed May 19, 2021
1 parent d56f925 commit 31fab93
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
8 changes: 7 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ markdown2extras: tables, code-friendly
-->

<!--
Copyright 2020 Joyent, Inc.
Copyright 2021 Joyent, Inc.
Copyright 2021 The University of Queensland
-->


Expand Down Expand Up @@ -880,6 +881,10 @@ Note that a `Triton-Datacenter-Name` response header was added in 9.2.0.

The section describes API changes in CloudAPI versions.

## 9.15.0

- Allow setting the `primary` option with the AddNic API [#84].

## 9.14.0

- Expose Feed of Machines Changes [#68](https://github.com/joyent/sdc-cloudapi/pull/68).
Expand Down Expand Up @@ -9796,6 +9801,7 @@ Creates a new NIC on an instance belonging to a given account.
**Field** | **Type** | **Description**
--------- | -------- | ---------------
network | Object or String | [Network object](#network-objects) or network UUID string.
primary | Boolean | Whether to make this NIC the new primary NIC

### Returns

Expand Down
9 changes: 7 additions & 2 deletions lib/nics.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
*/

/*
* Copyright 2020 Joyent, Inc.
* Copyright 2021 Joyent, Inc.
* Copyright 2021 The University of Queensland
*/

/*
Expand Down Expand Up @@ -108,6 +109,8 @@ function addNic(req, res, next) {
var login = req.account.login;
var networkArg = req.params.network;
var origin = req.params.origin || 'cloudapi';
var isPrimary = req.params.primary === true ||
req.params.primary === 'true';
var context = {
caller: req._auditCtx
};
Expand Down Expand Up @@ -368,6 +371,7 @@ function addNic(req, res, next) {
owner_uuid: ownerUuid,
state: 'provisioning',
origin: origin,
primary: isPrimary,
context: context
};

Expand Down Expand Up @@ -460,7 +464,8 @@ function addNic(req, res, next) {
creator_uuid: ownerUuid,
macs: [nic.mac],
origin: origin,
context: context
context: context,
primary: isPrimary
}, {
log: log,
headers: headers
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cloudapi",
"description": "Triton CloudAPI",
"version": "9.14.1",
"version": "9.15.0",
"author": "Joyent (joyent.com)",
"private": true,
"engines": {
Expand Down

0 comments on commit 31fab93

Please sign in to comment.